diff --git a/en/application-dev/application-models/abilitystage.md b/en/application-dev/application-models/abilitystage.md
index 4e0a273f850b4919d0964580ebed89c053c273f7..2f44f69d5810bbddf8128777f63360a1cb196fa3 100644
--- a/en/application-dev/application-models/abilitystage.md
+++ b/en/application-dev/application-models/abilitystage.md
@@ -12,7 +12,7 @@ AbilityStage is not automatically generated in the default project of DevEco Stu
1. In the **ets** directory of the **Module** project, right-click and choose **New > Directory** to create a directory named **myabilitystage**.
-2. In the **myabilitystage** directory, right-click and choose **New > ts File** to create a file named **MyAbilityStage.ts**.
+2. In the **myabilitystage** directory, right-click and choose **New > TypeScript File** to create a file named **MyAbilityStage.ts**.
3. Open the **MyAbilityStage.ts** file, and import the dependency package of AbilityStage. Customize a class that inherits from AbilityStage, and add the required lifecycle callbacks. The following code snippet adds the **onCreate()** lifecycle callback.
@@ -20,16 +20,27 @@ AbilityStage is not automatically generated in the default project of DevEco Stu
import AbilityStage from '@ohos.app.ability.AbilityStage';
export default class MyAbilityStage extends AbilityStage {
- onCreate() {
- // When the HAP of the application is loaded for the first time, initialize the module.
- }
- onAcceptWant(want) {
- // Triggered only for the ability with the specified launch type.
- return "MyAbilityStage";
- }
+ onCreate() {
+ // When the HAP of the application is loaded for the first time, initialize the module.
+ }
+ onAcceptWant(want) {
+ // Triggered only for the ability with the specified launch type.
+ return "MyAbilityStage";
+ }
+ }
+ ```
+
+4. Set **srcEntry** in the [module.json5 file](../quick-start/module-configuration-file.md) to the code path of the module.
+ ```json
+ {
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "srcEntry": "./ets/myabilitystage/MyAbilityStage.ts",
+ // ...
+ }
}
```
-
[AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) has the lifecycle callback [onCreate()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageoncreate) and the event callbacks [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant), [onConfigurationUpdated()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonconfigurationupdate), and [onMemoryLevel()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonmemorylevel).
@@ -49,9 +60,8 @@ When an application is switched to the background, it is cached in the backgroun
import AbilityStage from '@ohos.app.ability.AbilityStage';
export default class MyAbilityStage extends AbilityStage {
- onMemoryLevel(level) {
- // Release unnecessary memory based on the change of available system memory.
- }
+ onMemoryLevel(level) {
+ // Release unnecessary memory based on the change of available system memory.
+ }
}
```
-
diff --git a/en/application-dev/application-models/accessibilityextensionability.md b/en/application-dev/application-models/accessibilityextensionability.md
index 4c912d5e58a1b8083ba1037cccf449dd953d245c..688eaefa4bc10723d23f880dfbb4c1502cb42053 100644
--- a/en/application-dev/application-models/accessibilityextensionability.md
+++ b/en/application-dev/application-models/accessibilityextensionability.md
@@ -12,10 +12,13 @@ The **AccessibilityExtensionAbility** module provides accessibility extension ca
This document is organized as follows:
-- [Creating an AccessibilityExtAbility File](#creating-an-accessibility-extension-service)
-- [Processing an Accessibility Event](#processing-an-accessibility-event)
-- [Declaring Capabilities of Accessibility Extension Services](#declaring-capabilities-of-accessibility-extension-services)
-- [Enabling a Custom Accessibility Extension Service](#enabling-a-custom-accessibility-extension-service)
+- [AccessibilityExtensionAbility Development](#accessibilityextensionability-development)
+ - [Creating an Accessibility Extension Service](#creating-an-accessibility-extension-service)
+ - [Creating a Project](#creating-a-project)
+ - [Creating an AccessibilityExtAbility File](#creating-an-accessibilityextability-file)
+ - [Processing an Accessibility Event](#processing-an-accessibility-event)
+ - [Declaring Capabilities of Accessibility Extension Services](#declaring-capabilities-of-accessibility-extension-services)
+ - [Enabling a Custom Accessibility Extension Service](#enabling-a-custom-accessibility-extension-service)
## Creating an Accessibility Extension Service
@@ -79,13 +82,13 @@ You can also process physical key events in the accessibility extension service.
## Declaring Capabilities of Accessibility Extension Services
-After developing the custom logic for an accessibility extension service, you must add the configuration information of the service to the corresponding module-level **module.json5** file in the project directory. In the file, the **srcEntrance** tag indicates the path to the accessibility extension service. Make sure the value of the **type** tag is fixed at **accessibility**. Otherwise, the connection to the service will fail.
+After developing the custom logic for an accessibility extension service, you must add the configuration information of the service to the corresponding module-level **module.json5** file in the project directory. In the file, the **srcEntry** tag indicates the path to the accessibility extension service. Make sure the value of the **type** tag is fixed at **accessibility**. Otherwise, the connection to the service will fail.
```json
"extensionAbilities": [
{
"name": "AccessibilityExtAbility",
- "srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts",
+ "srcEntry": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts",
"label": "$string:MainAbility_label",
"description": "$string:MainAbility_desc",
"type": "accessibility",
diff --git a/en/application-dev/application-models/application-context-stage.md b/en/application-dev/application-models/application-context-stage.md
index aa40d3aedf9dbb3db775a634dbd81f60f22fed51..84188352e2b224ba24e9121dce147e39553ce61c 100644
--- a/en/application-dev/application-models/application-context-stage.md
+++ b/en/application-dev/application-models/application-context-stage.md
@@ -187,13 +187,13 @@ The base class **Context** provides [createBundleContext(bundleName:string)](../
> **NOTE**
>
> To obtain the context of another application:
- >
+ >
> - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
- >
+ >
> - This is a system API and cannot be called by third-party applications.
For example, application information displayed on the home screen includes the application name and icon. The home screen application calls the foregoing method to obtain the context information, so as to obtain the resource information including the application name and icon.
-
+
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
@@ -248,7 +248,7 @@ The base class **Context** provides [createBundleContext(bundleName:string)](../
In the DFX statistics scenario of an application, if you need to collect statistics on the stay duration and access frequency of a page, you can subscribe to UIAbility lifecycle changes in a process.
-[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext) provides APIs for subscribing to UIAbility lifecycle changes in a process. When the UIAbility lifecycle changes in a process, for example, being created or destroyed, becoming visible or invisible, or gaining or losing focus, the corresponding callback is triggered. Each time the callback is registered, a listener lifecycle ID is returned, with the value incremented by 1 each time. When the number of listeners exceeds the upper limit (2^63-1), **-1** is returned. The following uses [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) as an example.
+[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md) provides APIs for subscribing to UIAbility lifecycle changes in a process. When the UIAbility lifecycle changes in a process, for example, being created or destroyed, becoming visible or invisible, or gaining or losing focus, the corresponding callback is triggered. Each time the callback is registered, a listener lifecycle ID is returned, with the value incremented by 1 each time. When the number of listeners exceeds the upper limit (2^63-1), **-1** is returned. The following uses [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) as an example.
```ts
@@ -308,7 +308,7 @@ export default class EntryAbility extends UIAbility {
// Obtain the application context.
let applicationContext = this.context.getApplicationContext();
// Register the application lifecycle callback.
- this.lifecycleId = applicationContext.on('Lifecycle', abilityLifecycleCallback);
+ this.lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback);
console.log(TAG, `register callback number: ${this.lifecycleId}`);
}
diff --git a/en/application-dev/application-models/arkts-ui-widget-update-by-status.md b/en/application-dev/application-models/arkts-ui-widget-update-by-status.md
index 154eb03701ba2a1589c5ca81fd4d8e9edcf0865b..8952b8dff4ecdd3acad6b1a65513d8e529c4dc70 100644
--- a/en/application-dev/application-models/arkts-ui-widget-update-by-status.md
+++ b/en/application-dev/application-models/arkts-ui-widget-update-by-status.md
@@ -74,7 +74,7 @@ Multiple widgets of the same application can be configured to implement differen
}
Row() {// Content that is updated only in state A
- Text('状态A: ')
+ Text('State A: ')
Text(this.textA)
}
diff --git a/en/application-dev/application-models/common-event-static-subscription.md b/en/application-dev/application-models/common-event-static-subscription.md
index 013d7709e8c1588571e5c53f2a60ea012ee4f1fa..a545f6464b052cb20bd931b21820d623ad13f9c6 100644
--- a/en/application-dev/application-models/common-event-static-subscription.md
+++ b/en/application-dev/application-models/common-event-static-subscription.md
@@ -22,8 +22,6 @@ A static subscriber is started once it receives a target event published by the
You can implement service logic in the **onReceiveEvent** callback.
-
-
2. Project Configuration for a Static Subscriber
After writing the static subscriber code, configure the subscriber in the **module.json5** file. The configuration format is as follows:
@@ -35,12 +33,12 @@ A static subscriber is started once it receives a target event published by the
"extensionAbilities": [
{
"name": "StaticSubscriber",
- "srcEntrance": "./ets/StaticSubscriber/StaticSubscriber.ts",
+ "srcEntry": "./ets/StaticSubscriber/StaticSubscriber.ts",
"description": "$string:StaticSubscriber_desc",
"icon": "$media:icon",
"label": "$string:StaticSubscriber_label",
"type": "staticSubscriber",
- "visible": true,
+ "exported": true,
"metadata": [
{
"name": "ohos.extension.staticSubscriber",
@@ -56,7 +54,7 @@ A static subscriber is started once it receives a target event published by the
Pay attention to the following fields in the JSON file:
- - **srcEntrance**: entry file path of the ExtensionAbility, that is, the file path of the static subscriber declared in Step 2.
+ - **srcEntry**: entry file path of the ExtensionAbility, that is, the file path of the static subscriber declared in Step 2.
- **type**: ExtensionAbility type. For a static subscriber, set this field to **staticSubscriber**.
@@ -98,5 +96,5 @@ A static subscriber is started once it receives a target event published by the
"ohos.extension.staticSubscriber",
"xxx"
}
- ```
+ ```
diff --git a/en/application-dev/application-models/datashareextensionability.md b/en/application-dev/application-models/datashareextensionability.md
index f671848f890277af92fc23869c5db0d57b02a316..bea3de69c6d7ad375206fb1d53bcc36c2624989d 100644
--- a/en/application-dev/application-models/datashareextensionability.md
+++ b/en/application-dev/application-models/datashareextensionability.md
@@ -1,4 +1,4 @@
# DataShareExtensionAbility (for System Applications Only)
-DataShareExtensionAbility provides the data sharing capability. System applications can implement a DataShareExtensionAbility or access an existing DataShareExtensionAbility in the system. Third-party applications can only access an existing DataShareExtensionAbility. For details, see [DataShare Development](../database/database-datashare-guidelines.md).
+DataShareExtensionAbility provides the data sharing capability. System applications can implement a DataShareExtensionAbility or access an existing DataShareExtensionAbility in the system. Third-party applications can only access an existing DataShareExtensionAbility. For details, see [Cross-Application Data Sharing Overview](../database/share-device-data-across-apps-overview.md).
diff --git a/en/application-dev/application-models/enterprise-extensionAbility.md b/en/application-dev/application-models/enterprise-extensionAbility.md
index 18d5ec828126a2d11b57bf4dd482c4af56fa14bc..da8054e54284cc3a32af5ea6acaafc9eabc01561 100644
--- a/en/application-dev/application-models/enterprise-extensionAbility.md
+++ b/en/application-dev/application-models/enterprise-extensionAbility.md
@@ -2,12 +2,11 @@
## Introduction to EnterpriseAdminExtensionAbility
-EnterpriseAdminExtensionAbility is a mandatory component for Mobile Device Management (MDM) applications. When developing MDM applications for enterprises, you need to inherit EnterpriseAdminExtensionAbility and implement MDM service logic in the EnterpriseAdminExtensionAbility instance. EnterpriseAdminExtensionAbility implements notifications of system management status changes and defines the callbacks when a device administrator application is enabled or disabled or an application is installed or uninstalled.
+EnterpriseAdminExtensionAbility is a mandatory component for Mobile Device Management (MDM) applications. When developing MDM applications for enterprises, you need to inherit EnterpriseAdminExtensionAbility and implement MDM service logic in the EnterpriseAdminExtensionAbility instance. EnterpriseAdminExtensionAbility implements notifications of system management status changes and defines the callbacks for when a device administrator application is enabled or disabled or an application is installed or uninstalled.
## Constraints
- EnterpriseAdminExtensionAbility is applicable only to enterprise administrator applications.
-
+EnterpriseAdminExtensionAbility is applicable only to enterprise administrator applications.
## Observing Activation/Deactivation of a Device Administrator Application and Installation/Removal of an Application
@@ -24,59 +23,59 @@ EnterpriseAdminExtensionAbility is a mandatory component for Mobile Device Manag
### Available APIs
| Class | API | Description |
-| :------------------------------ | ----------------------------------------- | ---------------------------- |
+| ------------------------------ | ----------------------------------------- | ---------------------------- |
+| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | Called when a device administrator application is activated. |
| EnterpriseAdminExtensionAbility | onAdminDisabled(): void | Called when a device administrator application is deactivated.|
| EnterpriseAdminExtensionAbility | onBundleAdded(bundleName: string): void | Called when an application is installed on a device. |
-| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | Called when a device administrator application is activated. |
| EnterpriseAdminExtensionAbility | onBundleRemoved(bundleName: string): void | Called when an application is removed from a device. |
### How to Develop
To implement EnterpriseAdminExtensionAbility, you need to activate the device administrator application and create **ExtensionAbility** in the code directory of the device administrator application. The procedure is as follows:
-1. In the **ets** directory of the **Module** project, right-click and choose **New > Directory** to create a directory named **EnterpriseExtAbility**.
+1. In the **ets** directory of the target module, right-click and choose **New > Directory** to create a directory named **EnterpriseExtAbility**.
2. Right-click the **EnterpriseExtAbility** directory, and choose **New > TypeScript File** to create a file named **EnterpriseExtAbility.ts**.
3. Open the **EnterpriseExtAbility.ts** file and import the **EnterpriseAdminExtensionAbility** module. Inherit the **EnterpriseAdminExtensionAbility** module to the custom class and add application notification callbacks, such as **onAdminEnabled()** and **onAdminDisabled()**. When the device administrator application is activated or deactivated, the device administrator can receive notifications.
-```ts
-import EnterpriseAdminExtensionAbility from '@ohos.enterprise.EnterpriseAdminExtensionAbility';
-
-export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
-
- onAdminEnabled() {
- console.info("onAdminEnabled");
- }
-
- onAdminDisabled() {
- console.info("onAdminDisabled");
- }
-
- onBundleAdded(bundleName: string) {
- console.info("EnterpriseAdminAbility onBundleAdded bundleName:" + bundleName)
- }
-
- onBundleRemoved(bundleName: string) {
- console.info("EnterpriseAdminAbility onBundleRemoved bundleName" + bundleName)
- }
-};
-```
-
- 4. Register **ServiceExtensionAbility** in the [**module.json5**](../quick-start/module-configuration-file.md) file corresponding to the project module. Set **type** to **enterpriseAdmin** and **srcEntrance** to the path of the ExtensionAbility code.
-
-```ts
-"extensionAbilities": [
- {
- "name": "ohos.samples.enterprise_admin_ext_ability",
- "type": "enterpriseAdmin",
- "visible": true,
- "srcEntrance": "./ets/enterpriseextability/EnterpriseAdminAbility.ts"
- }
- ]
-```
+ ```ts
+ import EnterpriseAdminExtensionAbility from '@ohos.enterprise.EnterpriseAdminExtensionAbility';
+
+ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
+
+ onAdminEnabled() {
+ console.info("onAdminEnabled");
+ }
+
+ onAdminDisabled() {
+ console.info("onAdminDisabled");
+ }
+
+ onBundleAdded(bundleName: string) {
+ console.info("EnterpriseAdminAbility onBundleAdded bundleName:" + bundleName)
+ }
+
+ onBundleRemoved(bundleName: string) {
+ console.info("EnterpriseAdminAbility onBundleRemoved bundleName" + bundleName)
+ }
+ };
+ ```
+
+4. Register **ServiceExtensionAbility** in the [**module.json5**](../quick-start/module-configuration-file.md) file corresponding to the project module. Set **type** to **enterpriseAdmin** and **srcEntry** to the path of the ExtensionAbility code.
+
+ ```ts
+ "extensionAbilities": [
+ {
+ "name": "ohos.samples.enterprise_admin_ext_ability",
+ "type": "enterpriseAdmin",
+ "exported": true,
+ "srcEntry": "./ets/enterpriseextability/EnterpriseAdminAbility.ts"
+ }
+ ]
+ ```
## Example
-Use **subscribeManagedEvent()** and **unsubscribeManagedEvent()** in the @ohos.enterprise.adminManager module to subscribe to application installation and removal events. When an application is installed or removed, the MDM application is notified of the event. Then, the MDM application reports the event in the callback to notify the enterprise administrator.
+Use **subscribeManagedEvent** in the **@ohos.enterprise.adminManager** module to subscribe to application installation and removal events. When an application is installed or removed, the MDM application is notified of the event. Then, the MDM application reports the event in the callback to notify the enterprise administrator. To unsubscribe from events, use **unsubscribeManagedEvent**.
```ts
@State managedEvents: Array = [0,1]
@@ -105,3 +104,4 @@ Use **subscribeManagedEvent()** and **unsubscribeManagedEvent()** in the @ohos.e
})
}
```
+
diff --git a/en/application-dev/application-models/figures/standard-mode.png b/en/application-dev/application-models/figures/standard-mode.png
deleted file mode 100644
index fc903e6c1be80d3c00281d00d9ab0a1e334d7724..0000000000000000000000000000000000000000
Binary files a/en/application-dev/application-models/figures/standard-mode.png and /dev/null differ
diff --git a/en/application-dev/application-models/figures/uiability-launch-type1.gif b/en/application-dev/application-models/figures/uiability-launch-type1.gif
new file mode 100644
index 0000000000000000000000000000000000000000..d31a51a1aa97d32ee0ee7df4803378c1b7124119
Binary files /dev/null and b/en/application-dev/application-models/figures/uiability-launch-type1.gif differ
diff --git a/en/application-dev/application-models/figures/uiability-launch-type1.png b/en/application-dev/application-models/figures/uiability-launch-type1.png
deleted file mode 100644
index c4f5aa4b9a988d8e7148b504c4dcc163961cb103..0000000000000000000000000000000000000000
Binary files a/en/application-dev/application-models/figures/uiability-launch-type1.png and /dev/null differ
diff --git a/en/application-dev/application-models/figures/uiability-launch-type2.gif b/en/application-dev/application-models/figures/uiability-launch-type2.gif
new file mode 100644
index 0000000000000000000000000000000000000000..ecb3c413e3af2f92ef6834024d0d413e30c2419f
Binary files /dev/null and b/en/application-dev/application-models/figures/uiability-launch-type2.gif differ
diff --git a/en/application-dev/application-models/figures/uiability-launch-type2.png b/en/application-dev/application-models/figures/uiability-launch-type2.png
deleted file mode 100644
index 6f0e43d24f745aee41601cc48f4bc138572fbeb5..0000000000000000000000000000000000000000
Binary files a/en/application-dev/application-models/figures/uiability-launch-type2.png and /dev/null differ
diff --git a/en/application-dev/application-models/figures/uiability-launch-type3.gif b/en/application-dev/application-models/figures/uiability-launch-type3.gif
new file mode 100644
index 0000000000000000000000000000000000000000..029e8ba7e90eb836f8466c604d4fcf8171ffec6e
Binary files /dev/null and b/en/application-dev/application-models/figures/uiability-launch-type3.gif differ
diff --git a/en/application-dev/application-models/hop-multi-device-collaboration.md b/en/application-dev/application-models/hop-multi-device-collaboration.md
index 7cf66fbab7a98b109de3f9ffcc2fc7b7a2ecd127..721e135179810539bf6782489b67d2619536e8d2 100644
--- a/en/application-dev/application-models/hop-multi-device-collaboration.md
+++ b/en/application-dev/application-models/hop-multi-device-collaboration.md
@@ -187,7 +187,7 @@ On device A, touch the **Start** button provided by the initiator application to
// ...
- // context is the UIAbilityContext of the initiator UIAbility.
+ // context is the AbilityContext of the initiator UIAbility.
this.context.startAbilityForResult(want).then((data) => {
if (data?.resultCode === RESULT_CODE) {
// Parse the information returned by the target UIAbility.
@@ -384,12 +384,12 @@ The following describes how to implement multi-device collaboration through cros
```json
"abilities":[{
"name": ".CalleeAbility",
- "srcEntrance": "./ets/CalleeAbility/CalleeAbility.ts",
+ "srcEnty": "./ets/CalleeAbility/CalleeAbility.ts",
"launchType": "singleton",
"description": "$string:CalleeAbility_desc",
"icon": "$media:icon",
"label": "$string:CalleeAbility_label",
- "visible": true
+ "exported": true
}]
```
@@ -459,7 +459,7 @@ The following describes how to implement multi-device collaboration through cros
onDestroy() {
try {
- this.callee.off(MSG_SEND_METHOD)
+ this.callee.off(MSG_SEND_METHOD)
} catch (error) {
console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`)
}
@@ -491,7 +491,7 @@ The following describes how to implement multi-device collaboration through cros
if (data != null) {
caller = data
console.info('get remote caller success')
- // Register the onRelease listener of the CallerAbility.
+ // Register the onRelease() listener of the CallerAbility.
caller.onRelease((msg) => {
console.info(`remote caller onRelease is called ${msg}`)
})
diff --git a/en/application-dev/application-models/inputmethodextentionability.md b/en/application-dev/application-models/inputmethodextentionability.md
index 8a7856f402bf30b1610521e3cf05dda7145c3509..2b3910707ecdb6f964822380a85b14857ec8fd29 100644
--- a/en/application-dev/application-models/inputmethodextentionability.md
+++ b/en/application-dev/application-models/inputmethodextentionability.md
@@ -54,7 +54,7 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
1. **InputMethodService.ts** file:
- In this file, add the dependency package for importing InputMethodExtensionAbility. Customize a class that inherits from InputMethodExtensionAbility and add the required lifecycle callbacks.
+ In the **InputMethodService.ts** file, add the dependency package for importing InputMethodExtensionAbility. Customize a class that inherits from InputMethodExtensionAbility and add the required lifecycle callbacks.
```ts
import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility';
@@ -233,7 +233,7 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
Add the path to this file to the **src** field in the **resources/base/profile/main_pages.json** file.
- ```ets
+ ```ts
import { numberSourceListData, sourceListType } from './keyboardKeyData'
@Component
@@ -342,7 +342,7 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
}
```
- Register the InputMethodExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the target module. Set **type** to **"inputMethod"** and **srcEntrance** to the code path of the InputMethodExtensionAbility component.
+ Register the InputMethodExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the target module. Set **type** to **"inputMethod"** and **srcEntry** to the code path of the InputMethodExtensionAbility component.
```ts
{
@@ -353,9 +353,9 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
"description": "inputMethod",
"icon": "$media:icon",
"name": "InputMethodExtAbility",
- "srcEntrance": "./ets/inputmethodextability/InputMethodService.ts",
+ "srcEntry": "./ets/inputmethodextability/InputMethodService.ts",
"type": "inputMethod",
- "visible": true,
+ "exported": true,
}
]
}
diff --git a/en/application-dev/application-models/lifecycleapp-switch.md b/en/application-dev/application-models/lifecycleapp-switch.md
index 892a8915bfed9927c2707364bdaffa1547f71bf6..9d89597ef5a77246ec7450261916061062d24d8d 100644
--- a/en/application-dev/application-models/lifecycleapp-switch.md
+++ b/en/application-dev/application-models/lifecycleapp-switch.md
@@ -1,17 +1,17 @@
# LifecycleApp Switching
- | API in the FA Model| Corresponding d.ts File in the Stage Model| Corresponding API in the Stage Model|
+| API in the FA Model| Corresponding d.ts File in the Stage Model| Corresponding API in the Stage Model|
| -------- | -------- | -------- |
| onShow?(): void; | \@ohos.window.d.ts | [on(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType>): void;](../reference/apis/js-apis-window.md#onwindowstageevent9) Listens for the switching to the [foreground](../reference/apis/js-apis-window.md#windowstageeventtype9).|
| onHide?(): void; | \@ohos.window.d.ts | [on(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType>): void;](../reference/apis/js-apis-window.md#onwindowstageevent9) Listens for the switching to the [background](../reference/apis/js-apis-window.md#windowstageeventtype9).|
-| onDestroy?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onDestroy(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityondestroy) |
+| onDestroy?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onDestroy(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityondestroy) |
| onCreate?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) |
| onWindowDisplayModeChanged?(isShownInMultiWindow: boolean, newConfig: resourceManager.Configuration): void; | There is no corresponding API in the stage model.| No corresponding API is provided.|
| onStartContinuation?(): boolean; | There is no corresponding API in the stage model.| In the stage model, an application does not need to detect whether the continuation is successful (detected when the application initiates the continuation request). Therefore, the **onStartContinuation()** callback is deprecated.|
| onSaveData?(data: Object): boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) |
| onCompleteContinuation?(result: number): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
-| onRestoreData?(data: Object): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) [onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) In standard or singleton mode, the target ability completes data restoration in the **onCreate()** callback. In the callback, **launchParam.launchReason** is used to determine whether it is a continuation-based launch scenario. If it is, the data saved before continuation can be obtained from the **want** parameter.|
+| onRestoreData?(data: Object): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) [onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) In multiton or singleton mode, the target ability completes data restoration in the **onCreate()** callback. In the callback, **launchParam.launchReason** is used to determine whether it is a continuation-based launch scenario. If it is, the data saved before continuation can be obtained from the **want** parameter.|
| onRemoteTerminated?(): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
| onSaveAbilityState?(outState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) |
| onRestoreAbilityState?(inState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) After the application is restarted, the **onCreate()** callback is triggered. In the callback, **launchParam.launchReason** is used to determine whether it is a self-recovery scenario. If it is, the data saved before the restart can be obtained from the **want** parameter.|
diff --git a/en/application-dev/application-models/mission-management-launch-type.md b/en/application-dev/application-models/mission-management-launch-type.md
index 72b6dbf80df2628119ebcc29339ed7e4b70e9a50..6bad0ba0079e7087406000cd1a5e5ffb54a4f17c 100644
--- a/en/application-dev/application-models/mission-management-launch-type.md
+++ b/en/application-dev/application-models/mission-management-launch-type.md
@@ -8,16 +8,19 @@ The following describes how the mission list manager manages the UIAbility insta
- **singleton**: Only one UIAbility instance exists for an application.
**Figure 1** Missions and singleton mode
+

-- **standard**: Each time **startAbility()** is called, a UIAbility instance is created in the application process.
+- **multiton**: Each time **startAbility()** is called, a **UIAbility** instance is created in the application process.
+
+ **Figure 2** Missions and multiton mode
- **Figure 2** Missions and standard mode
- 
+ 
-- **specified**: The ([onAcceptWant](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant)) method of [AbilityStage](abilitystage.md) determines whether to create an instance.
+- **specified**: The ([onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant)) method of [AbilityStage](abilitystage.md) determines whether to create an instance.
**Figure 3** Missions and specified mode
+

diff --git a/en/application-dev/application-models/mission-management-overview.md b/en/application-dev/application-models/mission-management-overview.md
index e371e8380fbd7e181e13f1d5f5e7487b15eb9ff1..8d219cf935b0f4cae4093b33ed760a3603538ecc 100644
--- a/en/application-dev/application-models/mission-management-overview.md
+++ b/en/application-dev/application-models/mission-management-overview.md
@@ -13,6 +13,7 @@ Before getting started with the development of mission management, be familiar w
- MissionListManager: system mission management module that maintains all the MissionLists and is consistent with the list in **Recents**.
**Figure 1** Mission management
+

diff --git a/en/application-dev/application-models/module-switch.md b/en/application-dev/application-models/module-switch.md
index f3d5bd1c643a21945c06bdda69657ff823168907..f86d416597febe296adf6bd38b6a3d87a86fdda7 100644
--- a/en/application-dev/application-models/module-switch.md
+++ b/en/application-dev/application-models/module-switch.md
@@ -8,7 +8,7 @@ When switching an application from the FA model to the stage model, you must mig
| Field Name in the FA Model| Field Description| Field Name in the Stage Model| Difference|
| -------- | -------- | -------- | -------- |
| mainAbility | Ability displayed on the Service Center icon. When the resident process is started, the **mainAbility** is started.| mainElement | The field name is changed, and the stage mode does not use the period (.) in ability names.|
-| package | Package name of the HAP file, which must be unique in the application.| / | The stage model uses **name** to ensure application uniqueness. To ensure a successful switching from the FA model to the stage model, **name** in the stage model must be the same as **package** in the FA model.|
+| package | Package name of the HAP file, which must be unique in the application.| / | The stage model uses **name** to ensure application uniqueness. |
| name | Class name of the HAP file.| / | This configuration is not enabled in the FA model, and the stage model does not have such a field.|
| supportedModes | Modes supported by the application. Currently, only the **drive** mode is defined.| / | This configuration is deprecated in the stage model.|
| moduleName in the distro object| Name of the current HAP file. moduleName in the distro object.| name | The field name is changed.|
@@ -21,11 +21,12 @@ When switching an application from the FA model to the stage model, you must mig
| shortcuts | Shortcuts of the application.| shortcut_config.json| In the stage model, the **shortcut_config.json** file is defined in **resources/base/profile** in the development view.|
| reqPermissions | Permissions that the application requests from the system when it is running.| requestPermissions | The field name is changed.|
| colorMode | Color mode of the application.| / | This configuration is not supported in the stage model.|
-| distroFilter | Distribution rules of the application.| distroFilter_config.json| In the stage model, the **distroFilter_config.json** file is defined in **resources/base/profile** in the development view.|
+| distributionFilter | Distribution rules of the application.| distroFilter_config.json| In the stage model, the **distroFilter_config.json** file is defined in **resources/base/profile** in the development view.|
| reqCapabilities | Device capabilities required for running the application.| / | This configuration is not supported in the stage model.|
| commonEvents | Common events.| common_event_config.json| In the stage model, the **common_event_config.json** file is defined in **resources/base/profile** in the development view.|
| entryTheme | Keyword of an OpenHarmony internal theme.| / | This configuration is not supported in the stage model.|
+
### Table 2 metaData Comparison
| Field Name Under metaData in the FA Model| Field Description| Field Name Under metaData in the Stage Model| Difference|
@@ -40,7 +41,8 @@ When switching an application from the FA model to the stage model, you must mig
| -------- | -------- | -------- | -------- |
| name | Key name that identifies a data item. The value is a string with a maximum of 255 bytes.| name | None.|
| value | Value of the data item. The value is a string with a maximum of 255 bytes.| value | None.|
-| extra | Format of the current custom data. The value is the resource value of **extra**.| resource | The field name is changed. For details, see [Table 4](#table-4-metadata-examples).|
+| extra | Format of the current custom data. The value is the resource value of **extra**.| resource | The field name is changed. For details, see [Table 4](#table 4-metadata-examples).|
+
### Table 4 metaData Examples
@@ -69,5 +71,5 @@ When switching an application from the FA model to the stage model, you must mig
| formsEnabled | Whether the ability can provide widgets.| / | This configuration is not supported in the stage model.|
| forms | Information about the widgets used by the ability. This field is valid only when **formsEnabled** is set to **true**.| form_config.json| In the stage model, the **form_config.json** file is defined in **resources/base/profile** in the development view.|
| srcLanguage | Programming language used to develop the ability.| / | This configuration is not supported in the stage model.|
-| srcPath | Path of the JS component code corresponding to the ability.| srcEntrance | Path of the JS code corresponding to the ability.|
+| srcPath | Path of the JS component code corresponding to the ability.| srcEnty | Path of the JS code corresponding to the ability.|
| uriPermission | Application data that the ability can access.| / | This configuration is not supported in the stage model.|
diff --git a/en/application-dev/application-models/pageability-launch-type.md b/en/application-dev/application-models/pageability-launch-type.md
index 5241a7cabefbf3e68e6a3f413b8892ef5f6ff8d3..3b75ff6a60899f19f08aad5235fb3dc49632cb01 100644
--- a/en/application-dev/application-models/pageability-launch-type.md
+++ b/en/application-dev/application-models/pageability-launch-type.md
@@ -5,10 +5,10 @@ Depending on the launch type, the action performed when the PageAbility starts d
**Table 1** PageAbility launch types
-| Launch Type| Description|
-| -------- | -------- |
-| singleton | Each time **startAbility()** is called, if an ability instance of this type already exists in the application process, the instance is reused. There is only one ability instance of this type in **Recents**. A typical scenario is as follows: When a user opens a video playback application and watches a video, returns to the home screen, and opens the video playback application again, the video that the user watched before returning to the home screen is still played.|
-| standard | Default type. Each time **startAbility()** is called, a new ability instance is created in the application process. Multiple ability instances of this type are displayed in **Recents**. A typical scenario is as follows: When a user opens a document application and touches **New**, a new document task is created. Multiple new document missions are displayed in **Recents**.|
+| Launch Type| Meaning | Description|
+| -------- | -------- | -------- |
+| singleton | Singleton mode| Each time **startAbility()** is called, if an ability instance of this type already exists in the application process, the instance is reused. There is only one ability instance of this type in **Recents**. A typical scenario is as follows: When a user opens a video playback application and watches a video, returns to the home screen, and opens the video playback application again, the video that the user watched before returning to the home screen is still played.|
+| standard | Multiton mode| Default type. Each time **startAbility()** is called, a new ability instance is created in the application process. Multiple ability instances of this type are displayed in **Recents**. A typical scenario is as follows: When a user opens a document application and touches **New**, a new document task is created. Multiple new document missions are displayed in **Recents**.|
You can set **launchType** in the **config.json** file to configure the launch type. The sample code is as follows:
@@ -19,8 +19,8 @@ You can set **launchType** in the **config.json** file to configure the launch t
// ...
"abilities": [
{
- // singleton mode.
- // standard mode.
+ // singleton means the singleton mode.
+ // standard means the multiton mode.
"launchType": "standard",
// ...
}
@@ -30,7 +30,8 @@ You can set **launchType** in the **config.json** file to configure the launch t
```
-When the PageAbility is started for the first time (either in standard or singleton mode), the [PageAbility lifecycle callbacks](pageability-lifecycle.md#table13118194914476) are triggered. When it is not started for the first time in singleton mode, the **onNewWant()** callback (as described in the table below) is triggered, but the **onCreate()** callback is not.
+When the PageAbility is started in multiton mode or it is started in singleton mode for the first time, the [PageAbility lifecycle callbacks](pageability-lifecycle.md#table13118194914476) are triggered. When it is not started for the first time in singleton mode, the **onNewWant()** callback (as described in the table below) is triggered, but the **onCreate()** callback is not.
+
**Table 2** Callbacks specific to the singleton mode
diff --git a/en/application-dev/application-models/process-model-stage.md b/en/application-dev/application-models/process-model-stage.md
index bbfa0602aecb127c5e484f0ebbdcb166f81310f7..03da480722de124a1ede58da52e74cd48c5f23f0 100644
--- a/en/application-dev/application-models/process-model-stage.md
+++ b/en/application-dev/application-models/process-model-stage.md
@@ -15,7 +15,8 @@ The OpenHarmony process model is shown below.
> NOTE
>
-> You can create ServiceExtensionAbility and DataShareExtensionAbility only for system applications.
+> - You can create ServiceExtensionAbility and DataShareExtensionAbility only for system applications.
+> - To view information about all running processes, run the **hdc shell** command to enter the shell CLI of the device, and run the **ps -ef** command.
A system application can apply for multi-process permissions (as shown in the following figure) and configure a custom process for an HAP. UIAbility, DataShareExtensionAbility, and ServiceExtensionAbility in the HAP run in the custom process. Different HAPs run in different processes by configuring different process names.
diff --git a/en/application-dev/application-models/redirection-rules.md b/en/application-dev/application-models/redirection-rules.md
index d7456653640942bca333a28f7f6d5262ec4d63f3..12926c13985dbc2a535206aa4f998df2c44b2ecb 100644
--- a/en/application-dev/application-models/redirection-rules.md
+++ b/en/application-dev/application-models/redirection-rules.md
@@ -7,13 +7,14 @@ Generally, UI redirection within an application is triggered by users. However,
The PageAbility has a UI. It can use **startAbility()** to start an ability that has a UI and is visible to users.
-The **visible** field under **abilities** in the **config.json** file specifies whether an ability can be started by other application components.
+The **exported** field under **abilities** in the **config.json** file specifies whether an ability can be started by other application components.
-**Table 1** Description of visible
+
+**Table 1** Description of exported
| Name| Description| Initial Value Allowed|
| -------- | -------- | -------- |
-| visible | Whether the ability can be called by other applications. **true**: The ability can be called by any application. **false**: The ability can be called only by other components of the same application.| Yes (initial value: **false**)|
+| exported | Whether the ability can be called by other applications. **true**: The ability can be called by any application. **false**: The ability can be called only by other components of the same application.| Yes (initial value: **false**)|
To enable an ability to be called by any application, configure the **config.json** file as follows:
@@ -24,7 +25,7 @@ To enable an ability to be called by any application, configure the **config.jso
// ...
"abilities": [
{
- "visible": "true",
+ "exported": "true",
// ...
}
]
@@ -33,4 +34,4 @@ To enable an ability to be called by any application, configure the **config.jso
```
-If the ability contains **skills**, you are advised to set **visible** to **true** so that the ability can be [implicitly started](explicit-implicit-want-mappings.md#matching-rules-of-implicit-want) by other applications. If this attribute is set to **false**, the system returns **PERMISSION_DENIED** when other applications attempt to start the ability. In this case, a system application can request the [START_INVISIBLE_ABILITY](../security/permission-list.md) permission to start the ability. Example abilities with **visible** set to **false** are home screen, voice assistant, or search assistant.
+If the ability contains **skills**, you are advised to set **exported** to **true** so that the ability can be [implicitly started](explicit-implicit-want-mappings.md#matching-rules-of-implicit-want) by other applications. If this attribute is set to **false**, the system returns **PERMISSION_DENIED** when other applications attempt to start the ability. In this case, a system application can request the [START_INVISIBLE_ABILITY](../security/permission-list.md) permission to start the ability. Example abilities with **exported** set to **false** are home screen, voice assistant, or search assistant.
diff --git a/en/application-dev/application-models/serviceextensionability.md b/en/application-dev/application-models/serviceextensionability.md
index 9ff7a0ae5d6df7574da19565c81411236dba3dda..2e9aaeb48100d86d0cd1c7a0e69ea01bf4ef2340 100644
--- a/en/application-dev/application-models/serviceextensionability.md
+++ b/en/application-dev/application-models/serviceextensionability.md
@@ -1,125 +1,151 @@
# ServiceExtensionAbility
+## Overview
-[ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) is an ExtensionAbility component of the service type that provides extension capabilities related to background services.
+[ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) is an ExtensionAbility component of the SERVICE type that provides capabilities related to background services. It holds an internal [ServiceExtensionContext](../reference/apis/js-apis-inner-application-serviceExtensionContext.md), through which a variety of APIs are provided for external systems.
+In this document, the started ServiceExtensionAbility component is called the server, and the component that starts ServiceExtensionAbility is called the client.
-ServiceExtensionAbility can be started or connected by other application components to process transactions in the background based on the request of the caller. System applications can call the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartserviceextensionability) method to start background services or call the [connectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextconnectserviceextensionability) method to connect to background services. Third-party applications can call only **connectServiceExtensionAbility()** to connect to background services. The differences between starting and connecting to background services are as follows:
+A ServiceExtensionAbility can be started or connected by other components to process transactions in the background based on the request of the caller. System applications can call the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartserviceextensionability) method to start background services or call the [connectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextconnectserviceextensionability) method to connect to background services. Third-party applications can call only **connectServiceExtensionAbility()** to connect to background services. The differences between starting and connecting to background services are as follows:
+- **Starting**: In the case that AbilityA starts ServiceB, they are weakly associated. After AbilityA exits, ServiceB can still exist.
-- In the case that AbilityA starts ServiceB, they are weakly associated. After AbilityA exits, ServiceB can still exist.
+- **Connecting**: In the case that AbilityA connects to ServiceB, they are strongly associated. After AbilityA exits, ServiceB also exits.
-- In the case that AbilityA connects to ServiceB, they are strongly associated. After AbilityA exits, ServiceB also exits.
+Note the following:
+- If a ServiceExtensionAbility is started only by means of connecting, its lifecycle is controlled by the client. A new connection is set up each time the client calls the [connectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextconnectserviceextensionability) method. When the client exits or calls the [disconnectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextdisconnectserviceextensionability) method, the connection is disconnected. After all connections are disconnected, the ServiceExtensionAbility automatically exits.
-Each type of ExtensionAbility has its own context. ServiceExtensionAbility has [ServiceExtensionContext](../reference/apis/js-apis-inner-application-serviceExtensionContext.md). In this document, the started ServiceExtensionAbility component is called the server, and the component that starts ServiceExtensionAbility is called the client.
-
-
-This topic describes how to use ServiceExtensionAbility in the following scenarios:
-
-
-- [Implementing a Background Service (for System Applications Only)](#implementing-a-background-service-for-system-applications-only)
-
-- [Starting a Background Service (for System Applications Only)](#starting-a-background-service-for-system-applications-only)
-
-- [Connecting to a Background Service](#connecting-to-a-background-service)
-
+- Once a ServiceExtensionAbility is started by means of starting, it will not exit automatically. System applications can call the [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstopserviceextensionability) method to stop it.
> **NOTE**
-> - OpenHarmony does not support third-party applications in implementing ServiceExtensionAbility. If you want to implement transaction processing in the background, use background tasks. For details, see [Background Task](../task-management/background-task-overview.md).
->
+>
+> - Currently, third-party applications cannot implement ServiceExtensionAbility. If you want to implement transaction processing in the background, use background tasks. For details, see [Background Task](../task-management/background-task-overview.md).
> - UIAbility of a third-party application can connect to ServiceExtensionAbility provided by the system through the context.
->
> - Third-party applications can connect to ServiceExtensionAbility provided by the system only when they gain focus in the foreground.
-
-## Implementing a Background Service (for System Applications Only)
+## Lifecycle
[ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) provides the callbacks **onCreate()**, **onRequest()**, **onConnect()**, **onDisconnect()**, and **onDestory()**. Override them as required. The following figure shows the lifecycle of ServiceExtensionAbility.
- **Figure 1** ServiceExtensionAbility lifecycle
+**Figure 1** ServiceExtensionAbility lifecycle

- **onCreate**
-
- This callback is triggered when a service is created for the first time. You can perform initialization operations, for example, registering a common event listener.
+
+ This callback is triggered when a ServiceExtensionAbility is created for the first time. You can perform initialization operations, for example, registering a common event listener.
> **NOTE**
>
- > If a service has been created, starting it again does not trigger the **onCreate()** callback.
+ > If a ServiceExtensionAbility has been created, starting it again does not trigger the **onCreate()** callback.
- **onRequest**
-
- This callback is triggered when another component calls the **startServiceExtensionAbility()** method to start the service. After being started, the service runs in the background.
+
+ This callback is triggered when another component calls the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartserviceextensionability) method to start a ServiceExtensionAbility. After being started, the ServiceExtensionAbility runs in the background. This callback is triggered each time the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartserviceextensionability) method is called.
- **onConnect**
-
- This callback is triggered when another component calls the **connectServiceExtensionAbility()** method to connect to the service. In this method, a remote proxy object (IRemoteObject) is returned, through which the client communicates with the server by means of RPC.
+
+ This callback is triggered when another component calls the [connectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextconnectserviceextensionability) method to connect to a ServiceExtensionAbility. In this method, a remote proxy object (IRemoteObject) is returned, through which the client communicates with the server by means of RPC. At the same time, the system stores the remote proxy object (IRemoteObject). If another component calls the [connectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextconnectserviceextensionability) method to connect to this ServiceExtensionAbility, the system directly returns the saved remote proxy object (IRemoteObject) and does not trigger the callback.
- **onDisconnect**
-
- This callback is triggered when a component calls the **disconnectServiceExtensionAbility()** method to disconnect from the service.
+
+ This callback is triggered when the last connection is disconnected. A connection is disconnected when the client exits or the [disconnectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextdisconnectserviceextensionability) method is called.
- **onDestroy**
- This callback is triggered when the service is no longer used and the instance is ready for destruction. You can clear resources in this callback, for example, deregister the listener.
+ This callback is triggered when ServiceExtensionAbility is no longer used and the instance is ready for destruction. You can clear resources in this callback, for example, deregister the listener.
+## Implementing a Background Service (for System Applications Only)
-## How to Develop
+### Preparations
-To implement a background service, manually create a ServiceExtensionAbility component in DevEco Studio. The procedure is as follows:
+Only system applications can implement ServiceExtensionAbility. You must make the following preparations before development:
-1. In the **ets** directory of the **Module** project, right-click and choose **New > Directory** to create a directory named **serviceextability**.
+- **Switching to the full SDK**: All APIs related to ServiceExtensionAbility are marked as system APIs and hidden by default. Therefore, you must manually obtain the full SDK from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../quick-start/full-sdk-switch-guide.md).
-2. In the **serviceextability** directory, right-click and choose **New > TypeScript File** to create a file named **ServiceExtAbility.ts**.
+- **Requesting the AllowAppUsePrivilegeExtension privilege**: Only applications with the **AllowAppUsePrivilegeExtension** privilege can develop ServiceExtensionAbility. For details about how to request the privilege, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).
-3. Open the **ServiceExtAbility.ts** file, import the [RPC module](../reference/apis/js-apis-rpc.md), and reload the **onRemoteMessageRequest()** method to receive messages from the client and return the processing result to the client. **REQUEST_VALUE** is used to verify the service request code sent by the client.
-
- ```ts
- import rpc from '@ohos.rpc';
-
- const REQUEST_CODE = 99;
-
- class StubTest extends rpc.RemoteObject {
- constructor(des) {
- super(des);
- }
-
- // Receive a message from the client and return the processing result to the client.
- onRemoteMessageRequest(code, data, reply, option) {
- if (code === REQUEST_CODE) {
- // Receive data from the client.
- // If the client calls data.writeInt() multiple times to write multiple pieces of data, the server can call data.readInt() multiple times to receive all the data.
- let optFir = data.readInt();
- let optSec = data.readInt();
- // The server returns the data processing result to the client.
- // In the example, the server receives two pieces of data and returns the sum of the two pieces of data to the client.
- reply.writeInt(optFir + optSec);
- }
- return true;
- }
-
- // Send messages to the client in synchronous or asynchronous mode.
- sendRequest(code, data, reply, options) {
- return null;
- }
- }
- ```
+### Defining IDL Interfaces
+
+As a background service, ServiceExtensionAbility needs to provide interfaces that can be called by external systems. You can define the interfaces in IDL files and use the [IDL tool](../IDL/idl-guidelines.md) to generate proxy and stub files. The following demonstrates how to define a file named **IIdlServiceExt.idl**:
+
+```cpp
+interface OHOS.IIdlServiceExt {
+ int ProcessData([in] int data);
+ void InsertDataToMap([in] String key, [in] int val);
+}
+```
+
+Create the **IdlServiceExt** directory in the **ets** directory corresponding to the module of the DevEco Studio project, and copy the files generated by the [IDL tool](../IDL/idl-guidelines.md) to this directory. Then create a file named **idl_service_ext_impl.ts** to implement the IDL interfaces.
+
+```
+├── ets
+│ ├── IdlServiceExt
+│ │ ├── i_idl_service_ext.ts # File generated.
+│ │ ├── idl_service_ext_proxy.ts # File generated.
+│ │ ├── idl_service_ext_stub.ts # File generated.
+│ │ ├── idl_service_ext_impl.ts # Custom file used to implement IDL interfaces.
+│ └
+└
+```
+
+An example of **idl_service_ext_impl.ts** is as follows:
+
+```ts
+import {processDataCallback} from './i_idl_service_ext';
+import {insertDataToMapCallback} from './i_idl_service_ext';
+import IdlServiceExtStub from './idl_service_ext_stub';
+
+const ERR_OK = 0;
+const TAG: string = "[IdlServiceExtImpl]";
+
+// You need to implement interfaces in this type.
+export default class ServiceExtImpl extends IdlServiceExtStub {
+ processData(data: number, callback: processDataCallback): void {
+ // Implement service logic.
+ console.info(TAG, `processData: ${data}`);
+ callback(ERR_OK, data + 1);
+ }
+
+ insertDataToMap(key: string, val: number, callback: insertDataToMapCallback): void {
+ // Implement service logic.
+ console.log(TAG, `insertDataToMap, key: ${key} val: ${val}`);
+ callback(ERR_OK);
+ }
+}
+```
+
+### Creating a ServiceExtensionAbility
+
+To manually create a ServiceExtensionAbility in the DevEco Studio project, perform the following steps:
+
+1. In the **ets** directory of the **Module** project, right-click and choose **New > Directory** to create a directory named **ServiceExtAbility**.
+
+2. In the **ServiceExtAbility** directory, right-click and choose **New > TypeScript File** to create a file named **ServiceExtAbility.ts**.
+
+ ```
+ ├── ets
+ │ ├── IdlServiceExt
+ │ │ ├── i_idl_service_ext.ts # File generated.
+ │ │ ├── idl_service_ext_proxy.ts # File generated.
+ │ │ ├── idl_service_ext_stub.ts # File generated.
+ │ │ ├── idl_service_ext_impl.ts # Custom file used to implement IDL interfaces.
+ │ ├── ServiceExtAbility
+ │ │ ├── ServiceExtAbility.ts
+ └
+ ```
+
+3. In the **ServiceExtAbility.ts** file, add the dependency package for importing ServiceExtensionAbility. Customize a class that inherits from ServiceExtensionAbility and implement the lifecycle callbacks, and return the previously defined **ServiceExtImpl** object in the **onConnect** lifecycle callback.
-4. In the **ServiceExtAbility.ts** file, add the dependency package for importing ServiceExtensionAbility. Customize a class that inherits from ServiceExtensionAbility and add the required lifecycle callbacks.
-
```ts
import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility';
- import rpc from '@ohos.rpc';
-
- const TAG: string = "[Example].[Entry].[ServiceExtAbility]";
- const REQUEST_CODE = 99;
+ import ServiceExtImpl from '../IdlServiceExt/idl_service_ext_impl';
- class StubTest extends rpc.RemoteObject {
- // ...
- }
+ const TAG: string = "[ServiceExtAbility]";
export default class ServiceExtAbility extends ServiceExtensionAbility {
+ serviceExtImpl = new ServiceExtImpl("ExtImpl");
+
onCreate(want) {
console.info(TAG, `onCreate, want: ${want.abilityName}`);
}
@@ -130,7 +156,8 @@ To implement a background service, manually create a ServiceExtensionAbility com
onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`);
- return new StubTest("test");
+ // Return the ServiceExtImpl object, through which the client can communicate with the ServiceExtensionAbility.
+ return this.serviceExtImpl;
}
onDisconnect(want) {
@@ -143,8 +170,8 @@ To implement a background service, manually create a ServiceExtensionAbility com
}
```
-5. Register ServiceExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the **Module** project. Set **type** to **"service"** and **srcEntrance** to the code path of the ExtensionAbility component.
-
+4. Register ServiceExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the **Module** project. Set **type** to **"service"** and **srcEntry** to the code path of the ServiceExtensionAbility component.
+
```json
{
"module": {
@@ -155,15 +182,14 @@ To implement a background service, manually create a ServiceExtensionAbility com
"icon": "$media:icon",
"description": "service",
"type": "service",
- "visible": true,
- "srcEntrance": "./ets/serviceextability/ServiceExtAbility.ts"
+ "exported": true,
+ "srcEntry": "./ets/ServiceExtAbility/ServiceExtAbility.ts"
}
]
}
}
```
-
## Starting a Background Service (for System Applications Only)
A system application uses the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartserviceextensionability) method to start a background service. The [onRequest()](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md#serviceextensionabilityonrequest) callback is invoked, and the **Want** object passed by the caller is received through the callback. After the background service is started, its lifecycle is independent of that of the client. In other words, even if the client is destroyed, the background service can still run. Therefore, the background service must be stopped by calling [terminateSelf()](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextterminateself) when its work is complete. Alternatively, another component can call [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstopserviceextensionability) to stop the background service.
@@ -173,7 +199,7 @@ A system application uses the [startServiceExtensionAbility()](../reference/apis
> [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartserviceextensionability), [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstopserviceextensionability), and [terminateSelf()](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextterminateself) of ServiceExtensionContext are system APIs and cannot be called by third-party applications.
1. Start a new ServiceExtensionAbility in a system application. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability).
-
+
```ts
let want = {
"deviceId": "",
@@ -188,7 +214,7 @@ A system application uses the [startServiceExtensionAbility()](../reference/apis
```
2. Stop ServiceExtensionAbility in the system application.
-
+
```ts
let want = {
"deviceId": "",
@@ -203,7 +229,7 @@ A system application uses the [startServiceExtensionAbility()](../reference/apis
```
3. ServiceExtensionAbility stops itself.
-
+
```ts
// this is the current ServiceExtensionAbility component.
this.context.terminateSelf().then(() => {
@@ -213,35 +239,71 @@ A system application uses the [startServiceExtensionAbility()](../reference/apis
})
```
-
> **NOTE**
>
> Background services can run in the background for a long time. To minimize resource usage, destroy it in time when a background service finishes the task of the requester. A background service can be stopped in either of the following ways:
>
> - The background service calls the [terminateSelf()](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextterminateself) method to automatically stop itself.
->
> - Another component calls the [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstopserviceextensionability) method to stop the background service.
->
> After either method is called, the system destroys the background service.
-
## Connecting to a Background Service
-Either a system application or a third-party application can connect to a service (service specified in the **Want** object) through [connectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextconnectserviceextensionability). The [onConnect()](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md#serviceextensionabilityonconnect) callback is invoked, and the **Want** object passed by the caller is received through the callback. In this way, a persistent connection is established.
+Either a system application or a third-party application can connect to a ServiceExtensionAbility (specified in the **Want** object) through [connectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextconnectserviceextensionability). The [onConnect()](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md#serviceextensionabilityonconnect) callback is invoked, and the **Want** object passed by the caller is received through the callback. In this way, a persistent connection is established.
The ServiceExtensionAbility component returns an IRemoteObject in the **onConnect()** callback. Through this IRemoteObject, you can define communication interfaces for RPC interaction between the client and server. Multiple clients can connect to the same background service at the same time. After a client finishes the interaction, it must call [disconnectServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextdisconnectserviceextensionability) to disconnect from the service. If all clients connected to a background service are disconnected, the system destroys the service.
- Call **connectServiceExtensionAbility()** to establish a connection to a background service. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability).
```ts
- import rpc from '@ohos.rpc';
-
- const REQUEST_CODE = 99;
let want = {
"deviceId": "",
"bundleName": "com.example.myapplication",
"abilityName": "ServiceExtAbility"
};
+ let options = {
+ onConnect(elementName, remote) {
+ /* The input parameter remote is the object returned by ServiceExtensionAbility in the onConnect lifecycle callback.
+ * This object is used for communication with ServiceExtensionAbility. For details, see the section below.
+ */
+ console.info('onConnect callback');
+ if (remote === null) {
+ console.info(`onConnect remote is null`);
+ return;
+ }
+ },
+ onDisconnect(elementName) {
+ console.info('onDisconnect callback')
+ },
+ onFailed(code) {
+ console.info('onFailed callback')
+ }
+ }
+ // The ID returned after the connection is set up must be saved. The ID will be passed for service disconnection.
+ let connectionId = this.context.connectServiceExtensionAbility(want, options);
+ ```
+
+- Use **disconnectServiceExtensionAbility()** to disconnect from the background service.
+
+ ```ts
+ // connectionId is returned when connectServiceExtensionAbility is called and needs to be manually maintained.
+ this.context.disconnectServiceExtensionAbility(connectionId).then((data) => {
+ console.info('disconnectServiceExtensionAbility success');
+ }).catch((error) => {
+ console.error('disconnectServiceExtensionAbility failed');
+ })
+ ```
+
+## Communication Between the Client and Server
+
+After obtaining the [rpc.RemoteObject](../reference/apis/js-apis-rpc.md#iremoteobject) object from the **onConnect()** callback, the client can communicate with ServiceExtensionAbility in either of the following ways:
+
+- Using the IDL interface provided by the server for communication (recommended)
+
+ ```ts
+ // The client needs to import idl_service_ext_proxy.ts provided by the server for external systems to the local project.
+ import IdlServiceExtProxy from '../IdlServiceExt/idl_service_ext_proxy';
+
let options = {
onConnect(elementName, remote) {
console.info('onConnect callback');
@@ -249,23 +311,54 @@ The ServiceExtensionAbility component returns an IRemoteObject in the **onConnec
console.info(`onConnect remote is null`);
return;
}
+ let serviceExtProxy = new IdlServiceExtProxy(remote);
+ // Communication is carried out by interface calling, without exposing RPC details.
+ serviceExtProxy.processData(1, (errorCode, retVal) => {
+ console.log(`processData, errorCode: ${errorCode}, retVal: ${retVal}`);
+ });
+ serviceExtProxy.insertDataToMap('theKey', 1, (errorCode) => {
+ console.log(`insertDataToMap, errorCode: ${errorCode}`);
+ })
+ },
+ onDisconnect(elementName) {
+ console.info('onDisconnect callback')
+ },
+ onFailed(code) {
+ console.info('onFailed callback')
+ }
+ }
+ ```
+
+- Calling [sendMessageRequest](../reference/apis/js-apis-rpc.md#sendmessagerequest9) to send messages to the server (not recommended)
+
+ ```ts
+ import rpc from '@ohos.rpc';
+
+ const REQUEST_CODE = 1;
+ let options = {
+ onConnect(elementName, remote) {
+ console.info('onConnect callback');
+ if (remote === null) {
+ console.info(`onConnect remote is null`);
+ return;
+ }
+ // Directly call the RPC interface to send messages to the server. The client needs to serialize the input parameters and deserialize the return values. The process is complex.
let option = new rpc.MessageOption();
- let data = new rpc.MessageParcel();
- let reply = new rpc.MessageParcel();
+ let data = new rpc.MessageSequence();
+ let reply = new rpc.MessageSequence();
data.writeInt(100);
- data.writeInt(200);
-
+
// @param code Indicates the service request code sent by the client.
- // @param data Indicates the {@link MessageParcel} object sent by the client.
+ // @param data Indicates the {@link MessageSequence} object sent by the client.
// @param reply Indicates the response message object sent by the remote service.
// @param options Specifies whether the operation is synchronous or asynchronous.
//
// @return Returns {@code true} if the operation is successful; returns {@code false} otherwise.
- remote.sendRequest(REQUEST_CODE, data, reply, option).then((ret) => {
+ remote.sendMessageRequest(REQUEST_CODE, data, reply, option).then((ret) => {
let msg = reply.readInt();
- console.info(`sendRequest ret:${ret} msg:${msg}`);
+ console.info(`sendMessageRequest ret:${ret} msg:${msg}`);
}).catch((error) => {
- console.info('sendRequest failed');
+ console.info('sendMessageRequest failed');
});
},
onDisconnect(elementName) {
@@ -275,18 +368,90 @@ The ServiceExtensionAbility component returns an IRemoteObject in the **onConnec
console.info('onFailed callback')
}
}
- // The ID returned after the connection is set up must be saved. The ID will be passed for service disconnection.
- let connectionId = this.context.connectServiceExtensionAbility(want, options);
```
-- Use **disconnectServiceExtensionAbility()** to disconnect from the background service.
-
+## Client Identity Verification by the Server
+
+When ServiceExtensionAbility is used to provide sensitive services, the client identity must be verified. You can implement the verification on the stub of the IDL interface. For details about the IDL interface implementation, see [Defining IDL Interfaces](#defining-idl-interfaces). Two verification modes are recommended:
+
+- **Verifying the client identity based on callerUid**
+
+ Call the [getCallingUid()](../reference/apis/js-apis-rpc.md#getcallinguid) method to obtain the UID of the client, and then call the [getBundleNameByUid()](../reference/apis/js-apis-bundleManager.md#bundlemanagergetbundlenamebyuid) method to obtain the corresponding bundle name. In this way, the client identify is verified. Note that [getBundleNameByUid()](../reference/apis/js-apis-bundleManager.md#bundlemanagergetbundlenamebyuid) is asynchronous, and therefore the server cannot return the verification result to the client. This verification mode applies when the client sends an asynchronous task execution request to the server. The sample code is as follows:
+
```ts
- let connectionId = 1 // ID returned when the service is connected through connectServiceExtensionAbility.
- this.context.disconnectServiceExtensionAbility(connectionId).then((data) => {
- console.info('disconnectServiceExtensionAbility success');
- }).catch((error) => {
- console.error('disconnectServiceExtensionAbility failed');
- })
+ import rpc from '@ohos.rpc';
+ import bundleManager from '@ohos.bundle.bundleManager';
+ import {processDataCallback} from './i_idl_service_ext';
+ import {insertDataToMapCallback} from './i_idl_service_ext';
+ import IdlServiceExtStub from './idl_service_ext_stub';
+
+ const ERR_OK = 0;
+ const ERR_DENY = -1;
+ const TAG: string = "[IdlServiceExtImpl]";
+
+ export default class ServiceExtImpl extends IdlServiceExtStub {
+ processData(data: number, callback: processDataCallback): void {
+ console.info(TAG, `processData: ${data}`);
+
+ let callerUid = rpc.IPCSkeleton.getCallingUid();
+ bundleManager.getBundleNameByUid(callerUid).then((callerBundleName) => {
+ console.info(TAG, 'getBundleNameByUid: ' + callerBundleName);
+ // Identify the bundle name of the client.
+ if (callerBundleName != 'com.example.connectextapp') { // The verification fails.
+ console.info(TAG, 'The caller bundle is not in whitelist, reject');
+ return;
+ }
+ // The verification is successful, and service logic is executed normally.
+ }).catch(err => {
+ console.info(TAG, 'getBundleNameByUid failed: ' + err.message);
+ });
+ }
+
+ insertDataToMap(key: string, val: number, callback: insertDataToMapCallback): void {
+ // Implement service logic.
+ console.log(TAG, `insertDataToMap, key: ${key} val: ${val}`);
+ callback(ERR_OK);
+ }
+ }
+ ```
+
+- **Verifying the client identity based on callerTokenId**
+
+ Call the [getCallingTokenId()](../reference/apis/js-apis-rpc.md#getcallingtokenid) method to obtain the token ID of the client, and then call the [verifyAccessTokenSync()](../reference/apis/js-apis-abilityAccessCtrl.md#verifyaccesstokensync) method to check whether the client has a specific permission. Currently, OpenHarmony does not support permission customization. Therefore, only [system-defined permissions](../security/permission-list.md) can be verified. The sample code is as follows:
+
+ ```ts
+ import rpc from '@ohos.rpc';
+ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
+ import {processDataCallback} from './i_idl_service_ext';
+ import {insertDataToMapCallback} from './i_idl_service_ext';
+ import IdlServiceExtStub from './idl_service_ext_stub';
+
+ const ERR_OK = 0;
+ const ERR_DENY = -1;
+ const TAG: string = "[IdlServiceExtImpl]";
+
+ export default class ServiceExtImpl extends IdlServiceExtStub {
+ processData(data: number, callback: processDataCallback): void {
+ console.info(TAG, `processData: ${data}`);
+
+ let callerTokenId = rpc.IPCSkeleton.getCallingTokenId();
+ let accessManger = abilityAccessCtrl.createAtManager();
+ // The permission to be verified varies depending on the service requirements. ohos.permission.SET_WALLPAPER is only an example.
+ let grantStatus =
+ accessManger.verifyAccessTokenSync(callerTokenId, "ohos.permission.SET_WALLPAPER");
+ if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
+ console.info(TAG, `PERMISSION_DENIED`);
+ callback(ERR_DENY, data); // The verification fails and an error is returned.
+ return;
+ }
+ callback(ERR_OK, data + 1); // The verification is successful, and service logic is executed normally.
+ }
+
+ insertDataToMap(key: string, val: number, callback: insertDataToMapCallback): void {
+ // Implement service logic.
+ console.log(TAG, `insertDataToMap, key: ${key} val: ${val}`);
+ callback(ERR_OK);
+ }
+ }
```
diff --git a/en/application-dev/application-models/start-page.md b/en/application-dev/application-models/start-page.md
index 58966d93cba037eaad141caaed0feaaaa672cde1..4296d832fdaafaba67544e8e62b5c7c08395ecdf 100644
--- a/en/application-dev/application-models/start-page.md
+++ b/en/application-dev/application-models/start-page.md
@@ -12,7 +12,7 @@ import featureAbility from '@ohos.ability.featureAbility';
async function restartAbility() {
let wantInfo = {
bundleName: "com.sample.MyApplication",
- abilityName: "EntryAbility",
+ abilityName: "MainAbility",
parameters: {
page: "pages/second"
}
@@ -70,7 +70,7 @@ struct Index {
```
-When the launch type of a PageAbility is set to **standard** or when the PageAbility with the launch type set to **singleton** is started for the first time, you can use the **parameters** parameter in **want** to transfer the pages information and use the **startAbility()** method to start the PageAbility. For details about the launch type, see [PageAbility Launch Type](pageability-launch-type.md). The target PageAbility can use the **featureAbility.getWant()** method in **onCreate** to obtain the **want** parameter, and then call **router.push** to start a specified page.
+When a PageAbility in multiton mode is started or when the PageAbility in singleton mode is started for the first time, you can use the **parameters** parameter in **want** to transfer the pages information and use the **startAbility()** method to start the PageAbility. For details about the launch type, see [PageAbility Launch Type](pageability-launch-type.md). The target PageAbility can use the **featureAbility.getWant()** method in **onCreate** to obtain the **want** parameter, and then call **router.push** to start a specified page.
When a user touches the button on the page of the caller PageAbility, the **startAbility()** method is called to start the target PageAbility. The **want** parameter in **startAbility()** carries the specified page information.
@@ -89,7 +89,7 @@ struct Index {
featureAbility.startAbility({
want: {
bundleName: "com.exm.myapplication",
- abilityName: "com.exm.myapplication.EntryAbility",
+ abilityName: "com.exm.myapplication.MainAbility",
parameters: { page: "pages/page1" }
}
}).then((data) => {
@@ -104,7 +104,7 @@ struct Index {
featureAbility.startAbility({
want: {
bundleName: "com.exm.myapplication",
- abilityName: "com.exm.myapplication.EntryAbility",
+ abilityName: "com.exm.myapplication.MainAbility",
parameters: { page: "pages/page2" }
}
}).then((data) => {
diff --git a/en/application-dev/application-models/thread-model-stage.md b/en/application-dev/application-models/thread-model-stage.md
index deaab60b7bd7549dcb96bc00d7896d5c67e5c5d2..4ca9fb3ed369f78cf12054c7b6da085b8640b1db 100644
--- a/en/application-dev/application-models/thread-model-stage.md
+++ b/en/application-dev/application-models/thread-model-stage.md
@@ -2,19 +2,14 @@
For an OpenHarmony application, each process has a main thread to provide the following functionalities:
-- Manage other threads.
-
-- Enable multiple UIAbility components of the same application to share the same main thread.
-
-- Distribute input events.
-
- Draw the UI.
-
-- Invoke application code callbacks (event processing and lifecycle callbacks).
-
+- Manage the ArkTS engine instance of the main thread so that multiple UIAbility components can run on it.
+- Manage ArkTS engine instances of other threads (such as the worker thread), for example, starting and terminating other threads.
+- Distribute interaction events.
+- Process application code callbacks (event processing and lifecycle management).
- Receive messages sent by the worker thread.
-In addition to the main thread, there is an independent thread, named worker. The worker thread is mainly used to perform time-consuming operations. It cannot directly operate the UI. The worker thread is created in the main thread and is independent of the main thread. A maximum of seven worker threads can be created.
+In addition to the main thread, there is an independent thread, named worker. The worker thread is mainly used to perform time-consuming operations. The worker thread is created in the main thread and is independent from the main thread. It cannot directly operate the UI. A maximum of seven worker threads can be created.

@@ -22,4 +17,5 @@ Based on the OpenHarmony thread model, different services run on different threa
> **NOTE**
>
-> The stage model provides only the main thread and worker thread. Emitter is mainly used for event synchronization within the main thread or between the main thread and worker thread.
+> - The stage model provides only the main thread and worker thread. Emitter is mainly used for event synchronization within the main thread or between the main thread and worker thread.
+> - To view thread information about an application process, run the **hdc shell** command to enter the shell CLI of the device, and then run the **ps -p ** -T command**, where ** indicates the ID of the application process.
diff --git a/en/application-dev/application-models/uiability-intra-device-interaction.md b/en/application-dev/application-models/uiability-intra-device-interaction.md
index 5ea819219e45d219e68aee7f34988f4822dda5a9..148e804f48531f286ecfe395d1ecd03464a5eb45 100644
--- a/en/application-dev/application-models/uiability-intra-device-interaction.md
+++ b/en/application-dev/application-models/uiability-intra-device-interaction.md
@@ -38,7 +38,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func
info: 'From the Index page of EntryAbility',
},
}
- // context is the UIAbilityContext of the initiator UIAbility.
+ // context is the AbilityContext of the initiator UIAbility.
this.context.startAbility(wantInfo).then(() => {
// ...
}).catch((err) => {
@@ -65,7 +65,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func
3. To stop the **UIAbility** instance after the FuncAbility service is complete, call **terminateSelf()** in FuncAbility.
```ts
- // context is the UIAbilityContext of the UIAbility instance to stop.
+ // context is the AbilityContext of the UIAbility instance to stop.
this.context.terminateSelf((err) => {
// ...
});
@@ -88,7 +88,7 @@ When starting FuncAbility from EntryAbility, you want the result to be returned
info: 'From the Index page of EntryAbility',
},
}
- // context is the UIAbilityContext of the initiator UIAbility.
+ // context is the AbilityContext of the initiator UIAbility.
this.context.startAbilityForResult(wantInfo).then((data) => {
// ...
}).catch((err) => {
@@ -124,7 +124,7 @@ When starting FuncAbility from EntryAbility, you want the result to be returned
// ...
- // context is the UIAbilityContext of the initiator UIAbility.
+ // context is the AbilityContext of the initiator UIAbility.
this.context.startAbilityForResult(want).then((data) => {
if (data?.resultCode === RESULT_CODE) {
// Parse the information returned by the target UIAbility.
@@ -187,7 +187,7 @@ This section describes how to start the UIAbility of another application through
entities: ['entity.system.default'],
}
- // context is the UIAbilityContext of the initiator UIAbility.
+ // context is the AbilityContext of the initiator UIAbility.
this.context.startAbility(wantInfo).then(() => {
// ...
}).catch((err) => {
@@ -251,7 +251,7 @@ If you want to obtain the return result when using implicit Want to start the UI
entities: ['entity.system.default'],
}
- // context is the UIAbilityContext of the initiator UIAbility.
+ // context is the AbilityContext of the initiator UIAbility.
this.context.startAbilityForResult(wantInfo).then((data) => {
// ...
}).catch((err) => {
@@ -289,7 +289,7 @@ If you want to obtain the return result when using implicit Want to start the UI
// Want parameter information.
};
- // context is the UIAbilityContext of the initiator UIAbility.
+ // context is the AbilityContext of the initiator UIAbility.
this.context.startAbilityForResult(want).then((data) => {
if (data?.resultCode === RESULT_CODE) {
// Parse the information returned by the target UIAbility.
@@ -322,7 +322,7 @@ let wantInfo = {
router: 'funcA',
},
}
-// context is the UIAbilityContext of the initiator UIAbility.
+// context is the AbilityContext of the initiator UIAbility.
this.context.startAbility(wantInfo).then(() => {
// ...
}).catch((err) => {
@@ -500,12 +500,12 @@ For the CalleeAbility, implement the callback to receive data and the methods to
```json
"abilities":[{
"name": ".CalleeAbility",
- "srcEntrance": "./ets/CalleeAbility/CalleeAbility.ts",
+ "srcEnty": "./ets/CalleeAbility/CalleeAbility.ts",
"launchType": "singleton",
"description": "$string:CalleeAbility_desc",
"icon": "$media:icon",
"label": "$string:CalleeAbility_label",
- "visible": true
+ "exported": true
}]
```
@@ -596,7 +596,7 @@ For the CalleeAbility, implement the callback to receive data and the methods to
2. Obtain the caller interface.
- The **UIAbilityContext** attribute implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **UIAbilityContext**, uses **startAbilityByCall** to start the CalleeAbility, obtain the caller object, and register the **onRelease** listener of the CallerAbility. You need to implement processing based on service requirements.
+ The **context** attribute of the UIAbility implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the UIAbility, uses **startAbilityByCall** to start the CalleeAbility, obtain the caller object, and register the **onRelease** listener of the CallerAbility. You need to implement processing based on service requirements.
```ts
diff --git a/en/application-dev/application-models/uiability-launch-type.md b/en/application-dev/application-models/uiability-launch-type.md
index cf185cd9dad9593534afef59babe5cbf37585cae..ff904d4f60918a5ceed622840d5a153e52f8d1a4 100644
--- a/en/application-dev/application-models/uiability-launch-type.md
+++ b/en/application-dev/application-models/uiability-launch-type.md
@@ -6,7 +6,7 @@ The launch type of the UIAbility component refers to the state of the UIAbility
- [Singleton](#singleton)
-- [Standard](#standard)
+- [Multiton](#multiton)
- [Specified](#specified)
@@ -18,8 +18,7 @@ The launch type of the UIAbility component refers to the state of the UIAbility
Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, if a UIAbility instance of this type already exists in the application process, the instance is reused. Therefore, only one UIAbility instance of this type exists in the system, that is, displayed in **Recents**.
**Figure 1** Demonstration effect in singleton mode
-
-
+
> **NOTE**
>
@@ -43,15 +42,15 @@ To use the singleton mode, set **launchType** in the [module.json5 configuration
```
-## Standard
+## Multiton
-In standard mode, each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, a new UIAbility instance of this type is created in the application process. Multiple UIAbility instances of this type are displayed in **Recents**.
+In multiton mode, each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, a new UIAbility instance of this type is created in the application process. Multiple UIAbility instances of this type are displayed in **Recents**.
-**Figure 2** Demonstration effect in standard mode
+**Figure 2** Demonstration effect in multiton mode
-
+
-To use the standard mode, set **launchType** in the [module.json5 configuration file](../quick-start/module-configuration-file.md) to **standard**.
+To use the multiton mode, set **launchType** in the [module.json5 file](../quick-start/module-configuration-file.md) to **multiton**.
```json
@@ -60,7 +59,7 @@ To use the standard mode, set **launchType** in the [module.json5 configuration
// ...
"abilities": [
{
- "launchType": "standard",
+ "launchType": "multiton",
// ...
}
]
@@ -73,14 +72,13 @@ To use the standard mode, set **launchType** in the [module.json5 configuration
The **specified** mode is used in some special scenarios. For example, in a document application, you want a document instance to be created each time you create a document, but you want to use the same document instance when you repeatedly open an existing document.
-**Figure 3** Demonstration effect in specified mode
-
-
+**Figure 3** Demonstration effect in specified mode
+
For example, there are two UIAbility components: EntryAbility and SpecifiedAbility (with the launch type **specified**). You are required to start SpecifiedAbility from EntryAbility.
1. In SpecifiedAbility, set the **launchType** field in the [module.json5 file](../quick-start/module-configuration-file.md) to **specified**.
-
+
```json
{
"module": {
@@ -95,8 +93,8 @@ For example, there are two UIAbility components: EntryAbility and SpecifiedAbili
}
```
-2. Create a unique string key for the instance. Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, the application, based on the key, identifies the UIAbility instance used to respond to the request. In EntryAbility, add a custom parameter, for example, **instanceKey**, to the [want](want-overview.md) parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to distinguish the UIAbility instance.
-
+2. Create a unique string key for the instance. Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, the application, based on the key, identifies the UIAbility instance used to respond to the request. In EntryAbility, add a custom parameter, for example, **instanceKey**, to the **want** parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to distinguish the UIAbility instance.
+
```ts
// Configure an independent key for each UIAbility instance.
// For example, in the document usage scenario, use the document path as the key.
@@ -120,10 +118,11 @@ For example, there are two UIAbility components: EntryAbility and SpecifiedAbili
// ...
})
```
-
-3. During running, the internal service of UIAbility determines whether to create multiple instances. If the key is matched, the UIAbility instance bound to the key is started. Otherwise, a new UIAbility instance is created.
- The launch type of SpecifiedAbility is set to **specified**. Before SpecifiedAbility is started, the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of the corresponding AbilityStage instance is invoked to parse the input **want** parameter and obtain the custom parameter **instanceKey**. A string key identifier is returned through the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of the AbilityStage instance. [If the returned key corresponds to a started UIAbility instance](mission-management-launch-type.md#fig14520125175314), that UIAbility instance is switched to the foreground and gains focus again. Otherwise, a new instance is created and started.
-
+
+3. Before SpecifiedAbility is started, the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of the corresponding AbilityStage instance is invoked to obtain the key of the UIAbility, because the launch type of SpecifiedAbility is set to **specified**. If a UIAbility instance matching the key exists, the system starts the UIAbility instance and invokes its [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback. Otherwise, the system creates a new UIAbility instance and invokes its [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) and [onWindowStageCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) callbacks.
+
+ In the sample code, the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback parses the **want** parameter to obtain the custom parameter **instanceKey**. The service logic returns a key string based on **instanceKey** parameter to identify the UIAbility instance. If the returned key maps to a started UIAbility instance, the system pulls the UIAbility instance back to the foreground and obtains the focus. If the returned key does not map to a started UIAbility instance, the system creates a new UIAbility instance and starts it.
+
```ts
import AbilityStage from '@ohos.app.ability.AbilityStage';
@@ -140,12 +139,12 @@ For example, there are two UIAbility components: EntryAbility and SpecifiedAbili
}
}
```
-
+
> **NOTE**
>
> 1. Assume that the application already has a UIAbility instance created, and the launch type of the UIAbility instance is set to **specified**. If [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called again to start the UIAbility instance, and the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of [AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) matches a created UIAbility instance, the original UIAbility instance is started, and no new UIAbility instance is created. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback is invoked, but the [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) and [onWindowStageCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) callbacks are not.
> 2. AbilityStage is not automatically generated in the default project of DevEco Studio. For details about how to create an AbilityStage file, see [AbilityStage Component Container](abilitystage.md).
-
+
For example, in the document application, different keys are bound to different document instances. Each time a document is created, a new key (for example, file path) is passed, and a new UIAbility instance is created when UIAbility is started in AbilityStage. However, when you open an existing document, the same UIAbility instance is started again in AbilityStage.
The following steps are used as an example.
@@ -153,6 +152,4 @@ For example, there are two UIAbility components: EntryAbility and SpecifiedAbili
1. Open file A. A UIAbility instance, for example, UIAbility instance 1, is started.
2. Close the process of file A in **Recents**. UIAbility instance 1 is destroyed. Return to the home screen and open file A again. A new UIAbility instance is started, for example, UIAbility instance 2.
3. Return to the home screen and open file B. A new UIAbility instance is started, for example, UIAbility instance 3.
- 4. Return to the home screen and open file A again. UIAbility instance 2 is started.
-
-
\ No newline at end of file
+ 4. Return to the home screen and open file A again. UIAbility instance 2 is started. This is because the system automatically matches the key of the UIAbility instance and starts the UIAbility instance that has a matching key. In this example, UIAbility instance 2 has the same key as file A. Therefore, the system pulls back UIAbility instance 2 and focuses it without creating a new instance.
diff --git a/en/application-dev/application-models/uiability-overview.md b/en/application-dev/application-models/uiability-overview.md
index cd059b9555bfd80c02c9bce66f4c50cd58fff568..7862f2038fc6c353629bcdc9b3e51cfb5bedb046 100644
--- a/en/application-dev/application-models/uiability-overview.md
+++ b/en/application-dev/application-models/uiability-overview.md
@@ -37,7 +37,7 @@ To enable an application to properly use a UIAbility component, declare the UIAb
"abilities": [
{
"name": "EntryAbility", // Name of the UIAbility component.
- "srcEntrance": "./ets/entryability/EntryAbility.ts", // Code path of the UIAbility component.
+ "srcEnty": "./ets/entryability/EntryAbility.ts", // Code path of the UIAbility component.
"description": "$string:EntryAbility_desc", // Description of the UIAbility component.
"icon": "$media:icon", // Icon of the UIAbility component.
"label": "$string:EntryAbility_label", // Label of the UIAbility component.
diff --git a/en/application-dev/application-models/widget-development-fa.md b/en/application-dev/application-models/widget-development-fa.md
index 062f1950d13f31f7eacfbb6470d005ad90c7de43..73cf20e0ce6ab82ae9e775dd8fb8f43922218b48 100644
--- a/en/application-dev/application-models/widget-development-fa.md
+++ b/en/application-dev/application-models/widget-development-fa.md
@@ -364,7 +364,7 @@ You can use the web-like paradigm (HML+CSS+JSON) to develop JS widget pages. Thi
> **NOTE**
>
-> Only the JavaScript-based web-like development paradigm is supported when developing the widget UI.
+> In the FA model, only the JavaScript-based web-like development paradigm is supported when developing the widget UI.
- HML: uses web-like paradigm components to describe the widget page information.
@@ -452,7 +452,7 @@ You can set router and message events for components on a widget. The router eve
2. Set the router event.
- **action**: **"router"**, which indicates a router event.
- - **abilityName**: name of the ability to redirect to (PageAbility component in the FA model and UIAbility component in the stage model). For example, the default MainAbility name created by DevEco Studio in the FA model is com.example.entry.MainAbility.
+ - **abilityName**: name of the ability to redirect to (PageAbility component in the FA model and UIAbility component in the stage model). For example, the default UIAbility name created by DevEco Studio in the FA model is com.example.entry.MainAbility.
- **params**: custom parameters passed to the target ability. Set them as required. The value can be obtained from **parameters** in **want** used for starting the target ability. For example, in the lifecycle function **onCreate** of the MainAbility in the FA model, **featureAbility.getWant()** can be used to obtain **want** and its **parameters** field.
3. Set the message event.
@@ -543,4 +543,3 @@ The following is an example:
}
}
```
-
diff --git a/en/application-dev/application-models/widget-switch.md b/en/application-dev/application-models/widget-switch.md
index 8d9823385a8a05f71c742327dc966054427a6718..0de83a6593f521e3b51b84dea5ff275e7ee5450f 100644
--- a/en/application-dev/application-models/widget-switch.md
+++ b/en/application-dev/application-models/widget-switch.md
@@ -11,7 +11,7 @@ Widget switching involves the following parts:
| Configuration Item | FA Model | Stage Model |
| ---------------- | ------------------------------------------- | ------------------------------------------------------------ |
| Configuration item location | **formAbility** and **forms** are in the **config.json** file.| **extensionAbilities** (configuration for **formExtensionAbility**) is in the **module.json5** file in the level-1 directory, and **forms** (configuration for **forms** contained in **formExtensionAbility**) is in the **form_config.json** file in the level-2 directory.|
-| Widget code path | Specified by **srcPath**, without the file name. | Specified by **srcEntrance**, with the file name. |
+| Widget code path | Specified by **srcPath**, without the file name. | Specified by **srcEnty**, with the file name. |
| Programming language | **srcLanguage** can be set to **js** or **ets**. | This configuration item is unavailable. Only ets is supported. |
| Whether to enable widgets | formsEnabled | This configuration item is unavailable. The setting of **type** set to **form** means that the widgets are enabled. |
| Ability type | type: service | type: form |
@@ -32,7 +32,7 @@ Figure 2 Widget configuration differences
| Item| FA Model| Stage Model|
| -------- | -------- | -------- |
-| Entry file| **form.ts** in the directory pointed to by **srcPath**| File pointed to by **srcEntrance**|
+| Entry file| **form.ts** in the directory pointed to by **srcPath**| File pointed to by **srcEnty**|
| Lifecycle| export default| import FormExtension from '\@ohos.app.form.FormExtensionAbility'; export default class FormAbility extends FormExtension|
diff --git a/en/application-dev/application-models/windowextensionability.md b/en/application-dev/application-models/windowextensionability.md
index bdbcb65ffca3aa635146cdb8dfa97763ce99d652..a307a1da5e1c21e11b71d054b8300bb35ddf0522 100644
--- a/en/application-dev/application-models/windowextensionability.md
+++ b/en/application-dev/application-models/windowextensionability.md
@@ -1,5 +1,6 @@
# WindowExtensionAbility
+
[WindowExtensionAbility](../reference/apis/js-apis-application-windowExtensionAbility.md) is a type of ExtensionAbility component that allows a system application to be embedded in and displayed over another application.
@@ -14,7 +15,7 @@ the context is [WindowExtensionContext](../reference/apis/js-apis-inner-applicat
>
-## Setting an Embedded Ability (for System Applications Only)
+## Setting an Embedded UIAbility (for System Applications Only)
The **WindowExtensionAbility** class provides **onConnect()**, **onDisconnect()**, and **onWindowReady()** lifecycle callbacks, which can be overridden.
@@ -58,7 +59,7 @@ To implement an embedded application, manually create a WindowExtensionAbility i
}
```
-4. Register the WindowExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the **Module** project. Set **type** to **"window"** and **srcEntrance** to the code path of the ExtensionAbility component.
+4. Register the WindowExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the **Module** project. Set **type** to **"window"** and **srcEnty** to the code path of the ExtensionAbility component.
```json
{
@@ -66,11 +67,11 @@ To implement an embedded application, manually create a WindowExtensionAbility i
"extensionAbilities": [
{
"name": "WindowExtAbility",
- "srcEntrance": "./ets/WindowExtAbility/WindowExtAbility.ts",
+ "srcEnty": "./ets/WindowExtAbility/WindowExtAbility.ts",
"icon": "$media:icon",
"description": "WindowExtension",
"type": "window",
- "visible": true,
+ "exported": true,
}
],
}
@@ -78,7 +79,7 @@ To implement an embedded application, manually create a WindowExtensionAbility i
```
-## Starting an Embedded Ability (for System Applications Only)
+## Starting an Embedded UIAbility (for System Applications Only)
System applications can load the created WindowExtensionAbility through the AbilityComponent.
diff --git a/en/application-dev/database/data-persistence-by-kv-store.md b/en/application-dev/database/data-persistence-by-kv-store.md
index 804fb6b12764b95cec9566bdc165234284d32a8d..2337702fb79b1d2c53154181362b393211f90f50 100644
--- a/en/application-dev/database/data-persistence-by-kv-store.md
+++ b/en/application-dev/database/data-persistence-by-kv-store.md
@@ -21,13 +21,13 @@ The key-value (KV) database stores data in the form of KV pairs. You can use KV
The following table lists the APIs used for KV data persistence. Most of the APIs are executed asynchronously, using a callback or promise to return the result. The following table uses the callback-based APIs as an example. For more information about the APIs, see [Distributed KV Store](../reference/apis/js-apis-distributedKVStore.md).
-| API| Description|
+| API| Description|
| -------- | -------- |
-| createKVManager(config: KVManagerConfig): KVManager | Creates a **KvManager** instance to manage database objects.|
-| getKVStore<T>(storeId: string, options: Options, callback: AsyncCallback<T>): void | Creates and obtains a KV store of the specified type.|
-| put(key: string, value: Uint8Array\|string\|number\|boolean, callback: AsyncCallback<void>): void | Adds a KV pair of the specified type to this KV store.|
-| get(key: string, callback: AsyncCallback<Uint8Array\|string\|boolean\|number>): void | Obtains the value of the specified key.|
-| delete(key: string, callback: AsyncCallback<void>): void | Deletes a KV pair based on the specified key.|
+| createKVManager(config: KVManagerConfig): KVManager | Creates a **KvManager** instance to manage database objects.|
+| getKVStore<T>(storeId: string, options: Options, callback: AsyncCallback<T>): void | Creates and obtains a KV store of the specified type.|
+| put(key: string, value: Uint8Array\|string\|number\|boolean, callback: AsyncCallback<void>): void | Adds a KV pair of the specified type to this KV store.|
+| get(key: string, callback: AsyncCallback<Uint8Array\|string\|boolean\|number>): void | Obtains the value of the specified key.|
+| delete(key: string, callback: AsyncCallback<void>): void | Deletes a KV pair based on the specified key.|
## How to Develop
@@ -35,10 +35,9 @@ The following table lists the APIs used for KV data persistence. Most of the API
1. Create a **KvManager** instance to manage database objects.
Example:
-
Stage model:
-
+
```js
// Import the module.
import distributedKVStore from '@ohos.data.distributedKVStore';
@@ -69,7 +68,7 @@ The following table lists the APIs used for KV data persistence. Most of the API
FA model:
-
+
```js
// Import the module.
import distributedKVStore from '@ohos.data.distributedKVStore';
@@ -93,14 +92,13 @@ The following table lists the APIs used for KV data persistence. Most of the API
```
2. Create and obtain a KV store.
-
+
Example:
-
```js
try {
const options = {
createIfMissing: true, // Whether to create a KV store when the database file does not exist. By default, a KV store is created.
- createIfMissing: true, // Whether to encrypt database files. By default, database files are not encrypted.
+ encrypt: false, // Whether to encrypt the KV store. By default, KV stores are not encrypted.
backup: false, // Whether to back up database files. By default, the database files are backed up.
autoSync: true, // Whether to automatically synchronize database files. The value **true** means to automatically synchronize database files; the value **false** (default) means the opposite.
kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION, // Type of the KV store to create. By default, a device KV store is created.
@@ -121,9 +119,8 @@ The following table lists the APIs used for KV data persistence. Most of the API
```
3. Use **put()** to add data to the KV store.
-
+
Example:
-
```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value_test_string';
@@ -145,9 +142,8 @@ The following table lists the APIs used for KV data persistence. Most of the API
> The **put()** method adds a KV pair if the specified key does not exists and changes the value if the the specified key already exists.
4. Use **get()** to obtain the value of a key.
-
+
Example:
-
```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value_test_string';
@@ -172,9 +168,8 @@ The following table lists the APIs used for KV data persistence. Most of the API
```
5. Use **delete()** to delete the data of the specified key.
-
+
Example:
-
```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value_test_string';
diff --git a/en/application-dev/database/data-sync-of-rdb-store.md b/en/application-dev/database/data-sync-of-rdb-store.md
index d3f5f42c5a5338f24698f35c0e7fced1c5447643..444c5ab1ffadf09cfea56732e417df660c20ca8d 100644
--- a/en/application-dev/database/data-sync-of-rdb-store.md
+++ b/en/application-dev/database/data-sync-of-rdb-store.md
@@ -3,7 +3,7 @@
## When to Use
-When creating a data table, you can set the table to support cross-device access. You can also use APIs to move the data to be accessed across devices to a distributed data.
+You can synchronize the application data in a local RDB store on a device to other divices that form a Super Device.
## Basic Concepts
@@ -51,14 +51,14 @@ When data is added, deleted, or modified, a notification is sent to the subscrib
The following table lists the APIs for cross-device data synchronization of RDB stores. Most of the APIs are executed asynchronously, using a callback or promise to return the result. The following table uses the callback-based APIs as an example. For more information about the APIs, see [RDB Store](../reference/apis/js-apis-data-relationalStore.md).
-| API| Description|
+| API| Description|
| -------- | -------- |
-| setDistributedTables(tables: Array<string>, callback: AsyncCallback<void>): void | Sets the distributed tables to be synchronized.|
-| sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array<[string, number]>>): void | Synchronizes data across devices.|
-| on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void | Subscribes to changes in the distributed data.|
-| off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void | Unsubscribe from changes in the distributed data.|
-| obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void; | Obtains the table name on the specified device based on the local table name.|
-| remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array<string> , callback: AsyncCallback<ResultSet>): void | Queries data from the RDB store of a remote device based on specified conditions.|
+| setDistributedTables(tables: Array<string>, callback: AsyncCallback<void>): void | Sets the distributed tables to be synchronized.|
+| sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array<[string, number]>>): void | Synchronizes data across devices.|
+| on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void | Subscribes to changes in the distributed data.|
+| off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void | Unsubscribe from changes in the distributed data.|
+| obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void; | Obtains the table name on the specified device based on the local table name.|
+| remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array<string> , callback: AsyncCallback<ResultSet>): void | Queries data from the RDB store of a remote device based on specified conditions.|
## How to Develop
@@ -68,7 +68,7 @@ The following table lists the APIs for cross-device data synchronization of RDB
> The data on a device can be synchronized only to the devices whose data security labels are not higher than the security level of the device. For details, see [Access Control Mechanism in Cross-Device Synchronization](sync-app-data-across-devices-overview.md#access-control-mechanism-in-cross-device-synchronization).
1. Import the module.
-
+
```js
import relationalStore from '@ohos.data.relationalStore';
```
@@ -79,7 +79,7 @@ The following table lists the APIs for cross-device data synchronization of RDB
2. Display a dialog box to ask authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization).
3. Create an RDB store and set a table for distributed synchronization.
-
+
```js
const STORE_CONFIG = {
name: 'RdbTest.db', // Database file name.
@@ -95,7 +95,7 @@ The following table lists the APIs for cross-device data synchronization of RDB
```
4. Synchronize data across devices. After **sync()** is called to trigger a synchronization, data is synchronized from the local device to all other devices on the network.
-
+
```js
// Construct the predicate object for synchronizing the distributed table.
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
@@ -114,7 +114,7 @@ The following table lists the APIs for cross-device data synchronization of RDB
```
5. Subscribe to changes in the distributed data. The data synchronization triggers the **observer** callback registered in **on()**. The input parameter of the callback is the ID of the device whose data changes.
-
+
```js
let observer = function storeObserver(devices) {
for (let i = 0; i < devices.length; i++) {
@@ -144,7 +144,7 @@ The following table lists the APIs for cross-device data synchronization of RDB
>
> **deviceIds** is obtained by using [devManager.getTrustedDeviceListSync](../reference/apis/js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are all system interfaces and available only to system applications.
-
+
```js
// Obtain device IDs.
import deviceManager from '@ohos.distributedHardware.deviceManager';
diff --git a/en/application-dev/database/sync-app-data-across-devices-overview.md b/en/application-dev/database/sync-app-data-across-devices-overview.md
index 875b70fef7d4b3bcd6b78a2102ec40c80d7da5f9..c2f6361786325ccd753aa8fa4afa3446d37b6e89 100644
--- a/en/application-dev/database/sync-app-data-across-devices-overview.md
+++ b/en/application-dev/database/sync-app-data-across-devices-overview.md
@@ -36,14 +36,4 @@ Strong consistency has high requirements on distributed data management and may
## Access Control Mechanism in Cross-Device Synchronization
-In the application data synchronization across devices, data access is controlled based on the device level and [data security label](access-control-by-device-and-data-level.md#data-security-labels). In principle, data can be synchronized only to the devices whose data security labels are not higher than the device's security level. The access control matrix is as follows:
-
-|Device Security Level|Data Security Labels of the Synchornizable Device|
-|---|---|
-|SL1|S1|
-|SL2|S1 to S2|
-|SL3|S1 to S3|
-|SL4|S1 to S4|
-|SL5|S1 to S4|
-
-For example, the security level of development boards RK3568 and Hi3516 is SL1. The database with data security label S1 can be synchronized with RK3568 and Hi3516, but the database with database labels S2-S4 cannot.
+When data is synchronized across devices, access control is performed based on the device level and data security label. For details, see [Access Control Mechanism in Cross-Device Synchronization](access-control-by-device-and-data-level.md#access-control-mechanism-in-cross-device-synchronization).
diff --git a/en/application-dev/faqs/Readme-EN.md b/en/application-dev/faqs/Readme-EN.md
index 872f525dc191173b3c7052b8f2b9b134926b1ceb..b9bde5d6ebd9c35e203d4f08ccb0e551c9eb6ad1 100644
--- a/en/application-dev/faqs/Readme-EN.md
+++ b/en/application-dev/faqs/Readme-EN.md
@@ -1,11 +1,19 @@
# FAQs
-- [Ability Framework Development](faqs-ability.md)
-- [Resource Management Development](faqs-globalization.md)
+- [Ability Development](faqs-ability.md)
+- [Bundle Management Development](faqs-bundle-management.md)
+- [Resource Manager Development](faqs-globalization.md)
- [Common Event and Notification Development](faqs-event-notification.md)
-- [Graphics and Image Development](faqs-graphics.md)
+- [Graphics Development](faqs-graphics.md)
+- [Window Management Development](faqs-window-manager.md)
+- [Multimedia Development](faqs-multimedia.md)
+- [Basic Security Capability Development](faqs-security.md)
+- [Ability Access Control Development](faqs-ability-access-control.md)
+- [Data Management Development](faqs-distributed-data-management.md)
- [File Management Development](faqs-file-management.md)
- [Network Management Development](faqs-network-management.md)
- [DFX Development](faqs-dfx.md)
+- [Pan-Sensor Development](faqs-sensor.md)
- [Startup Development](faqs-startup.md)
-- [Usage of Third- and Fourth-Party Libraries](faqs-third-fourth-party-library.md)
\ No newline at end of file
+- [Distributed Device Development](faqs-distributed-device-profile.md)
+- [Usage of Third- and Fourth-Party Libraries](faqs-third-fourth-party-library.md)
diff --git a/en/application-dev/faqs/faqs-ability-access-control.md b/en/application-dev/faqs/faqs-ability-access-control.md
new file mode 100644
index 0000000000000000000000000000000000000000..f336120a2b131eb75604fa3e51b1b8ff0130072e
--- /dev/null
+++ b/en/application-dev/faqs/faqs-ability-access-control.md
@@ -0,0 +1,7 @@
+# Application Access Control Development
+
+## Can the app listen for the permission change after its permission is modified in Settings?
+
+Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
+
+Third-party apps cannot listen for the permission change.
diff --git a/en/application-dev/faqs/faqs-ability.md b/en/application-dev/faqs/faqs-ability.md
index aab3ecc19aff704dbc34b9f7aa4d174344735453..b6901e40e6d84c622c41e487e30c62ba87a28ff4 100644
--- a/en/application-dev/faqs/faqs-ability.md
+++ b/en/application-dev/faqs/faqs-ability.md
@@ -1,68 +1,124 @@
-# Ability Framework Development
+# Ability Development
-## Is a guide similar to the Data ability development in the FA model available for the stage model?
+## How do I obtain a notification when the device orientation changes?
-Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-A guide is available for the **DataShareExtensionAbility** class, which provides APIs for sharing data with other applications and managing the data, in the stage model.
+**Solution**
-Reference: [DataShare Development](../database/database-datashare-guidelines.md)
+Use the **UIAbility.onConfigurationUpdate\(\)** callback to subscribe to system environment variable changes (including the language, color mode, and screen orientation).
-## What should I do if the UI does not respond when an ability is started?
+**Reference**
-Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+[Subscribing to System Environment Variable Changes](../application-models/subscribe-system-environment-variable-changes.md#using-uiability-for-subscription)
-1. If the ability is started using **startAbility**, check whether the **abilityName** field in **want** uses the bundle name as the prefix. If yes, delete the bundle name.
+## How do I redirect a user to a specified page after they touch a service widget?
-2. Make sure the ability's home page file configured by **onWindowStageCreate** in the **MainAbility.ts** file is defined in the **main_pages.json** file.
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-3. You are advised to use the SDK and OpenHarmony SDK versions released on the same day.
+**Solution**
-Reference: [Release Testing Version](https://gitee.com/openharmony-sig/oh-inner-release-management/blob/master/Release-Testing-Version.md)
+Configure a widget event with the redirected-to UIAbility specified, and call **loadContent** in the **onWindowStageCreate\(\)** callback of the target UIAbility to redirect to the specified page.
-## How do I set the UI of an ability to transparent?
+**Reference**
-Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
+[Developing Widget Events](../application-models/arkts-ui-widget-configuration.md)
-Set the background color of the top container component to transparent, and then set the **opacity** attribute of the XComponent to **0.01**.
+## How do I create a background service in the stage model?
-Example:
+Applicable to: OpenHarmony 3.2 Beta5
-```
-build() {
- Stack() {
- XComponent({
- id: 'componentId',
- type: 'surface',
- })
- .width('100%')
- .height('100%')
- .opacity(0.01)
- // Page content
- }
- .width('100%')
- .height('100%')
- .backgroundColor('rgba(255,255,255, 0)')
-}
-```
+**Symptom**
+
+**ServiceExtensionAbility** in the stage model is a system API. Therefore, third-party applications cannot use it to create a background service.
+
+**Solution**
+
+Create a background task to provide the background service.
+
+**Reference**
+
+[Background Task](../task-management/background-task-overview.md)
+
+## Can I create a UIAbility and specify the process to run the UIAbility in the FA and Stage models?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+Yes.
+
+- FA model
+
+ The FA model supports multiple processes. By default, all components of an application run in the same process. This default scenario is suitable for most applications. To run a specific component in an independent process, configure the **process** tag under **ability** in the configuration file. Note that this tag is available only for system applications.
+
+- Stage model
+
+ The stage model supports multiple processes. The process model is defined by the system, and third-party applications cannot be configured with multiple processes. To customize an independent process, you must request special permissions, and then specify the **process** tag under **module** in the configuration file. This tag specifies the process in which all the abilities in an HAP run. If this tag is not set, the bundle name is used as the process name by default.
+
+
+## What are the differences between the stage model and the FA model in intra-process object sharing?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+- In the stage model, multiple application components share the same ArkTS engine instance. Therefore, they can easily share objects and state with each other. This also reduces the memory usage of complex applications.
+- In the FA model, each application component exclusively uses an ArkTS engine instance. Therefore, you are advised to use the stage model when developing complex applications in distributed scenarios.
+
+**Reference**
+
+[Data Synchronization Between UIAbility and UI](../application-models/uiability-data-sync-with-ui.md)
+
+## How do I use the lifecycle functions of AbilityStage?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+Add the field **"srcEntry": "./ets/myabilitystage/MyAbilityStage.ts"** under **module** in the **module.json5** file.
+
+**Reference**
+
+[AbilityStage Component Container](../application-models/abilitystage.md)
+
+
+## How do I delete the mission snapshot in Recents after terminateself is called in the multiton scenario?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+You can set **removeMissionAfterTerminate** to **true** in the **module.json5** file.
+
+## Why can't I start a UIAbility instance by using startAbility\(\)?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+- If the UIAbility is started using **startAbility**, check whether the **abilityName** field in **want** uses the bundle name as the prefix. If yes, delete the bundle name.
+- Make sure the UIAbility's home page file configured by **onWindowStageCreate** in the **MainAbility.ts** file is defined in the **main\_pages.json** file. You are advised to use the SDK and OpenHarmony SDK versions released on the same day.
## How do I prevent "this" in a method from changing to "undefined" when the method is called?
-Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
-Method 1: Add **.bind(this)** when calling the method.
+Method 1: Add **.bind\(this\)** when calling the method.
Method 2: Use the arrow function.
-## What should I do when the message "must have required property 'startWindowIcon'" is displayed?
+## What should I do when the error message "must have required property 'startWindowIcon'" is displayed during the UIAbility startup?
-Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-Configure the **startWindowIcon** attribute under **abilities** in the **module.json5** file.
+**Solution**
-Reference: [Application Package Structure (Stage Model)](../quick-start/module-configuration-file.md)
+Configure the **startWindowIcon** attribute under **abilities** in the **module.json5** file.
-Example:
+**Example**
```
{
@@ -77,138 +133,226 @@ Example:
}
```
-## How do I obtain a notification when the device orientation changes?
-
-Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
+**Reference**
-Implement the **onConfigurationUpdated** callback in the **Ability** class. The callback is triggered when the system language, color mode, or display parameters (such as the orientation and density) change.
+[module.json5 Configuration File](../quick-start/module-configuration-file.md)
## Can I obtain the context through globalThis in the stage model?
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+Do not use **globalThis** to obtain the context in the stage model.
+
+This is because all the processes of an application share a JS VM instance in the stage model. Multiple abilities can run on these processes and share the same global object. If **globalThis** is used, the context of different abilities of the same JS VM instance may be returned.
+
+**Reference**
+
+[Data Synchronization Between UIAbility and UI](../application-models/uiability-data-sync-with-ui.md)
-Do not use **globalThis** to obtain the context in the stage model. This is because all the processes of an application share a JS VM instance in the stage model. Multiple abilities can run on these processes and share the same global object. If **globalThis** is used, the context of different abilities of the same JS VM instance may be returned.
+## What should I do when an error indicating too large size is reported during HAP deployment?
-Reference of the recommended operation: [Context (Stage Model)](../application-models/application-context-stage.md)
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-## How do I obtain the HAP installation path of application B from application A?
+**Symptom**
-Applicable to: OpenHarmony SDK 3.0 or later, stage model of API version 9
+During HAP deployment, the following error message is displayed:
-First, request the system permission. For details, see [Having Your App Automatically Signed](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-auto-configuring-signature-information-0000001271659465). Then, import the **bundle** module, and call **bundle.getApplicationInfo()** to obtain application information based on the bundle name. Finally, use **application.moduleSourceDirs** to obtain the application storage path.
+Failure\[INSTALL\_FAILED\_SIZE\_TOO\_LARGE\] error while deploying hap?
+
+**Solution**
+
+You can split the HAP into multiple HAPs.
## How is data returned when startAbilityForResult is called?
-Applicable to: OpenHarmony SDK3.0, stage model of API version 9
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-The callee uses **AbilityContext.terminateSelfWithResult** to destroy its ability and pass parameters to **startAbilityForResult**. For details, see [AbilityContext](../reference/apis/js-apis-ability-context.md#abilitycontextterminateselfwithresult).
+**Solution**
-## Can the lifecycle callback of a released FA widget be triggered when the widget is displayed in the service center so that the user login information can be obtained without opening the FA application?
+The target UIAbilities uses **AbilityContext.terminateSelfWithResult** to terminate itselef and pass the result to **startAbilityForResult**.
-Applicable to: OpenHarmony SDK 3.2.5.5, FA model of API version 8
+**Reference**
-After a widget is added, the **oncreate()** lifecycle is triggered so that related user information (silent login) can be displayed even when the application is not started. However, users must manually add the widget after the application is installed.
+[Starting UIAbility in the Same Application and Obtaining the Return Result](../application-models/uiability-intra-device-interaction.md)
-## How do I obtain the context?
-Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9
+## How do I obtain the system timestamp?
-You can use **this.context** to obtain the context in the **MainAbility.ts** file or call **getContext(this)** to obtain the context on the component page.
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-## What should I do when undefined is displayed for the calling of **abilityAccessCtrl.grantUserGrantedPermission** during API version 8 syntax verification?
+**Solution**
-Applicable to: OpenHarmony SDK 3.0, FA model of API version 8
+Use **getCurrentTime** of **@ohos.systemDateTime** to obtain the system time and time zone.
-**abilityAccessCtrl.grantUserGrantedPermission** is a system API. It is not available in the public SDK, which is provided as default on DevEco Studio. To use system APIs, switch to the full SDK. For details, see [Guide to Switching to Full SDK](../quick-start/full-sdk-switch-guide.md).
+**Example**
-## Which of the following Extension abilities are available in the public SDK: ServiceExtensionAbility, FormExtensionAbility, and DataShareExtensionAbility?
+Use the **@ohos.systemDateTime** API as follows:
-Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9
+ ```
+ try {
+ systemDateTime.getCurrentTime(true, (error, time) => {
+ if (error) {
+ console.info(`Failed to get currentTime. message: ${error.message}, code: ${error.code}`);
+ return;
+ }
+ console.info(`Succeeded in getting currentTime : ${time}`);
+ });
+ } catch(e) {
+ console.info(`Failed to get currentTime. message: ${e.message}, code: ${e.code}`);
+ }
+ ```
-Among the aforementioned Extension abilities, only **FormExtensionAbility** is available in the public SDK. **ServiceExtensionAbility** and **DataShareExtensionAbility** are system APIs and available only in the full SDK.
-Public SDK: intended for application developers and does not contain system APIs that require system permissions.
+**Reference**
-Full SDK: intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.
+[System time and time zone] (../reference/apis/js-apis-system-date-time.md#systemdatetimegetcurrenttime)
-## Why can't I play GIF images cyclically on the widget?
+## How do I obtain the cache directory of the current application?
-Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-The system does not support the display of GIF images on the widget.
+**Solution**
-## How do I implement service login by touching a widget?
+Use **Context.cacheDir** to obtain the cache directory of the application.
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
+**Reference**
-You can start an ability upon the touch and implement service login in the ability.
+[Obtaining the Application Development Path](../application-models/application-context-stage.md#obtaining-the-application-development-path)
-## How do I redirect to the application details page in Settings?
+## In which JS file is the service widget lifecycle callback invoked?
-Applicable to: OpenHarmony SDK 3.2.6.5
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-Refer to the following code:
+**Solution**
-```
-this.context.startAbility(
-{
- action: "action.settings.app.info",
- parameters: { "settingsParamBundleName": "your app bundlename" }
-})
-```
+When a widget is created, a **FormAblity.ts** file is generated, which contains the widget lifecycle.
-## How do I listen for screen rotation events?
+**Reference**
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
+[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)
-Refer to the following code:
+## What should I do when the compilation on DevEco Studio fails while ServiceExtensionAbility and DataShareExtensionAbility APIs are used?
-```
-let listener = mediaquery.matchMediaSync('(orientation: landscape)')
-onPortrait(mediaQueryResult) {
-if (mediaQueryResult.matches) {
-// Do something here.
- } else {
-// Do something here.
- }
-}
-listener.on('change', onPortrait)
-```
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Symptom**
+
+After the **ServiceExtensionAbility** and **DataShareExtensionAbility** APIs are used, DevEco Studio reports an error indicating that the compilation fails.
+
+**Cause**
+
+The following types of SDKs are provided:
+
+- Public SDK: intended for application developers and does not contain system APIs that require system permissions.
+- Full SDK: intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.
+
+The SDK downloaded using DevEco Studio is the public SDK.
+
+**Solution**
+
+Third-party application cannot use **ServiceExtensionAbility** and **DataShareExtensionAbility**. To develop a system application, first [download the full SDK](../quick-start/full-sdk-switch-guide.md).
+
+## How do I obtain the temp and files paths at the application level?
+
+Applicable to: OpenHarmony 3.2 Beta5
+
+**Solution**
+
+Obtain them from the application context. Specifically, use **this.context.getApplicationContext.tempDir** i to obtain the **temp** path, and use **this.context.getApplicationContext.filesDir** to obtain the **files** path.
+
+**Reference**
+
+[Obtaining the Application Development Path](../application-models/application-context-stage.md#obtaining-the-application-development-path)
+
+
+## Can the lifecycle callback of a released FA widget be triggered when the widget is displayed in the service center so that the user login information can be obtained without opening the FA application?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-## How do I control the shadow background size during checkbox selection?
+**Solution**
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
+After a widget is added, the **onCreate()** lifecycle is triggered so that related user information (silent login) can be displayed even when the application is not started. However, users must manually add the widget after the application is installed.
-Set the **padding** attribute of the **\** component to control the shadow size.
+## How do I implement service login by touching a widget?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+To create a service widget in the FA model, perform the following steps:
+
+1. Implement lifecycle callbacks for the widget.
+
+2. Configure the widget configuration file.
+
+3. Persistently store widget data.
-## How do I set the widget background to transparent?
+4. Update widget data.
-Applicable to: OpenHarmony SDK 3.2.5.5
+5. Develop the widget UI page.
-1. Create the **widget/resources/styles/default.json** file in the root directory of the widget.
+6. Develop a widget event. You can start a UIAbility upon the touch and implement service login in the UIAbility.
-2. Add the following code to the **default.json** file:
+**Reference**
+
+[Widget Development in the FA Model](../application-models/widget-development-fa.md)
+
+## How do I redirect to the application details page in Settings?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+Refer to the following code:
```
-{
- "style": {
- "app_background": "#00000000"
- }
-}
+this.context.startAbility(
+{
+ action: "action.settings.app.info",
+ parameters: { "settingsParamBundleName": "your app bundlename" }
+})
```
-## How do I pass parameters for FA widgets?
-
-Applicable to: OpenHarmony SDK 3.2.5.5
+## How do I get UIAbilityContext within the @Component component in the stage model?
-Use **featureAbility.getWant()** and **featureAbility.getContext()** to send data through **router** in the JSON file and use **featureAbility** to receive data in the JS file.
+Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
-## How do I trigger router.disableAlertBeforeBackPage and router.enableAlertBeforeBackPage?
+**Solution**
-Applicable to: OpenHarmony SDK 3.2.5.5
+You can use **UIAbility.Context** to obtain the context.
-The following conditions must be met:
+**Example**
-1. Before the redirection to the previous page, a confirm dialog box will be displayed. Note that **router.disableAlertBeforeBackPage** is used to disable the display of a confirm dialog box before returning to the previous page (default), and **router.enableAlertBeforeBackPage** is used to enable the display.
+```
+import UIAbility from '@ohos.app.ability.UIAbility';
+
+let UIAbilityContext = UIAbility.context;
+let ApplicationContext = UIAbility.context.getApplicationContext();
+@Entry
+@Component
+struct AbilityContextTest {
+ // abilityContext
+ @State UIabilityInfo: string = 'Obtaining abilityInfo'
+ UIabilityContext: UIAbilityContext
+
+ aboutToAppear() {
+ // Use getContext to obtain the context and convert it to abilityContext.
+ this.UIabilityContext = getContext(this) as UIAbilityContext
+ }
-2. The system return key is used.
+ build() {
+ Row() {
+ Column({ space: 20 }) {
+ Text(this.abilityInfo)
+ .fontSize(20)
+ .onClick(()=>{
+ this.UIabilityInfo = JSON.stringify(this.UIabilityContext.UIabilityInfo)
+ console.log(`ContextDemo abilityInfo= ${this.UIabilityInfo}`)
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
diff --git a/en/application-dev/faqs/faqs-bundle-management.md b/en/application-dev/faqs/faqs-bundle-management.md
new file mode 100644
index 0000000000000000000000000000000000000000..71b1e01ffcffea415266fb90213fc722e4f5b628
--- /dev/null
+++ b/en/application-dev/faqs/faqs-bundle-management.md
@@ -0,0 +1,126 @@
+# Bundle Management Development
+
+## How do I determine whether an application is a system application?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+Use **bundleManager.getApplicationInfo** (available only for system applications) to obtain application information, and check the value of **systemApp** in the information. The application is a system application if the value is **true**.
+
+**Reference**
+
+[bundleManager](../reference/apis/js-apis-bundleManager.md)
+
+## How do I obtain the version code and version name of an application?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+Use **bundleManager.getBundleInfoForSelf\(\)** to obtain the bundle information, which contains the version code (specified by **BundleInfo.versionCode**) and version name (specified by **BundleInfo.versionName**) .
+
+**Example**
+
+```
+import bundleManager from '@ohos.bundle.bundleManager';
+import hilog from '@ohos.hilog';
+let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT;
+try {
+ bundleManager.getBundleInfoForSelf(bundleFlags).then((data) => {
+ const versionCode = data.versionCode;
+ const versionName = data.versionName;
+ hilog.info(0x0000, 'testTag', `successfully. versionCode: ${versionCode}, versionName: ${versionName}`);
+ }).catch(err => {
+ hilog.error(0x0000, 'testTag', 'failed. Cause: %{public}s', err.message);
+ });
+} catch (err) {
+ hilog.error(0x0000, 'testTag', 'failed: %{public}s', err.message);
+}
+```
+
+**Reference**
+
+[getBundleInfoForSelf](../reference/apis/js-apis-bundleManager.md#bundlemanagergetbundleinfoforself)
+
+## How do I obtain the bundle name of the current application?
+
+Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
+
+**Solution**
+
+Obtain the bundle name from **UIAbilityContext.abilityInfo.bundleName**.
+
+**Example**
+
+```
+import common from '@ohos.app.ability.common';
+const context = getContext(this) as common.UIAbilityContext
+console.log(`bundleName: ${context.abilityInfo.bundleName}`)
+```
+
+**Reference**
+
+[UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontext) and [AbilityInfo](../reference/apis/js-apis-bundleManager-abilityInfo.md#abilityinfo)
+
+## How do I obtain the application version number, version name, and screen resolution?
+
+Applicable to: OpenHarmony 3.2 Beta5
+
+**Solution**
+
+1. Obtain the bundle information from the **@ohos.bundle.bundleManager** module.
+
+ The bundle information contains the application version number and version name.
+
+ ```
+ import bundleManager from '@ohos.bundle.bundleManager';
+ ...
+ bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then((bundleInfo)=>{
+ let versionName = bundleInfo.versionName; // Application version name.
+ let versionNo = bundleInfo.versionCode; // Application version number.
+ }).catch((error)=>{
+ console.error("get bundleInfo failed,error is "+error)
+ })
+ ```
+
+2. Obtain **screenDensity** from the **@ohos.app.ability.Configuration** module. **screenDensity** contains the screen resolution information.
+
+ ```
+ import common from '@ohos.app.ability.common';
+ ...
+ let context = getContext(this) as common.UIAbilityContext;
+ let screenDensity = context.config.screenDensity;
+ ```
+
+
+## How do I obtain the source file path of the current application?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+- Method 1: Use the application context to obtain the source file path.
+
+ ```
+ this.uiAbilityContext.abilityInfo.applicationInfo.codePath
+ ```
+
+- Method 2: Use **@ohos.bundle.bundleManager** to obtain the source file path.
+
+ 1. Import the **@ohos.bundle.bundleManager** module and use **bundleManager.getBundleInfoForSelf\(\)** to obtain the bundle information.
+ 2. Obtain the source file path from **bundleInfo.appInfo.codePath**.
+
+ ```
+ import bundleManager from '@ohos.bundle.bundleManager';
+ bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then((bundleInfo)=>{
+ this.sourcePath = bundleInfo.appInfo.codePath;
+ })
+ ```
+
+
+## Can I obtain the HAP information of other applications from the current application?
+
+Applicable to: OpenHarmony 3.2 Beta (API version 9)
+
+According to the OpenHarmony security design specifications, the SDK does not provide APIs for third-party applications to obtain bundle information (including but not limited to the application name and version number) of other applications.
diff --git a/en/application-dev/faqs/faqs-bundle.md b/en/application-dev/faqs/faqs-bundle.md
deleted file mode 100644
index fda41c42bccc357d6b8800ce3f5401e1e2abbceb..0000000000000000000000000000000000000000
--- a/en/application-dev/faqs/faqs-bundle.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Bundle Management Development
-
-## How do I obtain the version code and version name of an application?
-
-Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
-
-Use **bundle.getBundleInfo()** to obtain the bundle information, which contains the version code and version name.
-
-Reference: [Bundle](../reference/apis/js-apis-Bundle.md#bundlegetbundleinfo)
-
-## How do I obtain the bundle name of an application?
-
-Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
-
-Obtain the bundle name through **context.abilityInfo.bundleName**.
-
-Reference: [AbilityInfo](../reference/apis/js-apis-bundle-AbilityInfo.md)
-
-## How do I obtain an application icon?
-
-Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
-
-Use **bundle.getAbilityIcon** to obtain the application icon. To use this API, you must configure the permission **ohos.permission.GET_BUNDLE_INFO**.
-
-Reference: [Bundle](../reference/apis/js-apis-Bundle.md#bundlegetbundleinfo)
-
-## How do I determine whether an application is a system application?
-
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
-
-Use **bundle.getApplicationInfo** to obtain the application information, and then check the value of **systemApp** in the information. The application is a system application if the value is **true**.
diff --git a/en/application-dev/faqs/faqs-distributed-data-management.md b/en/application-dev/faqs/faqs-distributed-data-management.md
new file mode 100644
index 0000000000000000000000000000000000000000..c44b7b254ae85280e00430621845dd82d7e2fca6
--- /dev/null
+++ b/en/application-dev/faqs/faqs-distributed-data-management.md
@@ -0,0 +1,101 @@
+# Data Management Development
+
+
+## How do I encrypt an RDB store?
+
+Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
+
+**Solution**
+
+To encrypt an RDB store, set **encrypt** in **StoreConfig** to **true** when creating the RDB store.
+
+**Reference**
+
+[RDB Store](../reference/apis/js-apis-data-relationalStore.md#storeconfig)
+
+## What if I failed to clear a table in an RDB store using TRUNCATE TABLE?
+
+Applicable to: OpenHarmony SDK 3.2.9.2 (API version 9)
+
+**Symptom**
+
+An error is reported when the **TRUNCATE TABLE** statement is used to clear table data.
+
+**Solution**
+
+The RDB store uses SQLite and does not support the **TRUNCATE TABLE** statement. To clear a table in an RDB store, use the **DELETE** statement, for example, **DELETE FROM sqlite\_sequence WHERE name = 'table\_name'**.
+
+
+
+## What data types does an RDB store support?
+
+Applicable to: OpenHarmony SDK 3.0 or later, API version 9 stage model
+
+**Solution**
+
+An RDB store supports data of the number, string, and Boolean types. The number type supports data of the Double, Long, Float, Int, or Int64 type, with a maximum precision of 17 decimal digits.
+
+## How do I save pixel map data to a database?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Symptom**
+
+Pixel map data fails to be stored.
+
+**Solution**
+
+Convert the pixel map data into an **ArrayBuffer** and save the **ArrayBuffer** to your database.
+
+**Reference**
+
+[readPixelsToBuffer](../reference/apis/js-apis-image.md#readpixelstobuffer7-1)
+
+## How do I obtain RDB store files?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+The RDB store files are stored in **/data/app/el2/100/database/*Bundle_name*/entry/rdb/**. You can use the hdc command to copy the file from the directory and use a SQLite tool to open the file.
+
+Example:
+
+```
+ hdc file recv /data/app/el2/100/database//entry/db/ ./
+```
+
+## Do the OpenHarmony databases have a lock mechanism?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+The distributed data service (DDS), RDB store, and preferences provided OpenHarmony have a lock mechanism. You do not need to bother with the lock mechanism during the development.
+
+## What if I failed to use get() to obtain the data saved by @ohos.data.storage put()?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Symptom**
+
+After @ohos.data.storage **put()** is called to save data, **get()** is called to obtain the data. However, the data fails to be obtained.
+
+**Solution**
+
+The **put()** method provided by **@ohos.data.storage** saves data in the memory. When the application exits, the data in the memory will be cleared. If you want to persist the data, you need to call **flush()** or **flushSync()** after **put()**. After data is persisted, you can use **get()** to obtain the data after the application is restarted.
+
+
+## What if a large text file fails to be saved in an RDB store?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Symptom**
+
+In API version 8, large text files cannot be saved in RDB stores.
+
+**Solution**
+
+In versions earlier than API version 9, the maximum length of a text file is 1024 bytes. If the text file exceeds 1024 bytes, it cannot be saved.
+
+The limit on the text file size has been removed since API9 version.
diff --git a/en/application-dev/faqs/faqs-distributed-device-profile.md b/en/application-dev/faqs/faqs-distributed-device-profile.md
new file mode 100644
index 0000000000000000000000000000000000000000..8473e3d4bfcb36c02d3260312cf5379cb436d8a6
--- /dev/null
+++ b/en/application-dev/faqs/faqs-distributed-device-profile.md
@@ -0,0 +1,9 @@
+# Distributed Device Development
+
+## How do I view the IMEI of an OpenHarmony device?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+Obtain the device IMEI from the **HUKS\_TAG\_ATTESTATION\_ID\_IMEI** parameter of the **HuksTag** API. [Reference](../reference/apis/js-apis-huks.md)
diff --git a/en/application-dev/faqs/faqs-file-management.md b/en/application-dev/faqs/faqs-file-management.md
index 6214cbc6b61aadc0e7501fbf3166d050b46500cb..85763b7eb00f9b8805786e80c208ea4059e8bb0e 100644
--- a/en/application-dev/faqs/faqs-file-management.md
+++ b/en/application-dev/faqs/faqs-file-management.md
@@ -1,107 +1,21 @@
# File Management Development
-## Does fileio.rmdir Delete Files Recursively?
+## How do I obtain the path of system screenshots?
-Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-Yes. **fileio.rmdir** deletes files recursively.
+**Solution**
-## How Do I Create a File That Does Not Exist?
+The screenshots are stored in **/storage/media/100/local/files/Pictures/Screenshots/**.
-Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
+## How do I change the permissions on a directory to read/write on a device?
-You can use **fileio.open(filePath, 0o100, 0o666)**. The second parameter **0o100** means to create a file if it does not exist. The third parameter **mode** must also be specified.
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-## What If "call fail callback fail, code: 202, data: json arguments illegal" Is Displayed?
+**Symptom**
-Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
+When the hdc command is used to send a file to a device, "permission denied" is displayed.
-When the **fileio** module is used to copy files, the file path cannot start with "file:///".
+**Solution**
-## How Do I Read Files Outside the App Sandbox?
-
-Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9
-
-If the input parameter of the **fileio** API is **path**, only the sandbox directory of the current app obtained from the context can be accessed. To access data in other directories such as the user data, images, and videos, open the file as the data owner and operate with the file descriptor (FD) returned.
-
-For example, to read or write a file in Media Library, perform the following steps:
-
-1. Use **getFileAssets()** to obtain the **fileAsset** object.
-
-2. Use **fileAsset.open()** to obtain the FD.
-
-3. Use the obtained FD as the **fileIo** API parameter to read and write the file.
-
-## What If the File Contains Garbled Characters?
-
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
-
-Read the file content from the buffer, and decode the file content using **util.TextDecoder**.
-
-Example:
-
-```
-import util from '@ohos.util'
-async function readFile(path) {
- let stream = fileio.createStreamSync(path, "r+");
- let readOut = await stream.read(new ArrayBuffer(4096));
- let textDecoder = new util.TextDecoder("utf-8", { ignoreBOM: true });
- let buffer = new Uint8Array(readOut.buffer)
- let readString = textDecoder.decode(buffer, { stream: false });
- console.log ("[Demo] File content read: "+ readString);
-}
-```
-
-## What Should I Do If There Is No Return Value or Error Captured After getAlbums Is Called?
-
-Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
-
-The **ohos.permission.READ_MEDIA** is required for using **getAlbums()**. In addition, this permission needs user authorization. For details, see [OpenHarmony Permission List](../security/permission-list.md).
-
-1. Configure the required permission in the **module.json5** file.
-
- ```
- "requestPermissions": [
- {
- "name": "ohos.permission.READ_MEDIA"
- }
- ]
- ```
-
-2. Add the code for user authorization before the **MainAbility.ts -> onWindowStageCreate** page is loaded.
-
- ```
- import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
-
- private requestPermissions() {
- let permissionList: Array = [
- "ohos.permission.READ_MEDIA"
- ];
- let atManager = abilityAccessCtrl.createAtManager();
- atManager.requestPermissionsFromUser(this.context, permissionList)
- .then(data => {
- console.info(`request permission data result = ${data.authResults}`)
- })
- .catch(err => {
- console.error(`fail to request permission error:${err}`)
- })
- }
- ```
-
-## What Do I Do If the App Crashes When FetchFileResult() Is Called Multiple Times?
-
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
-
-Each time after the **FetchFileResult** object is called, call **FetchFileResult.close()** to release and invalidate the **FetchFileResult** object .
-
-## What If An Error Is Reported by IDE When mediaLibrary.getMediaLibrary() Is Called in the Stage Model?
-
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
-
-In the stage model, use **mediaLibrary.getMediaLibrary(context: Context)** to obtain the media library instance.
-
-## How Do I Sort the Data Returned by mediaLibrary.getFileAssets()?
-
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
-
-Use the **order** attribute in **[MediaFetchOptions](../reference/apis/js-apis-medialibrary.md#mediafetchoptions7)** to sort the data returned.
+Run the **hdc shell mount -o remount,rw /** command to grant the read/write permissions.
diff --git a/en/application-dev/faqs/faqs-graphics.md b/en/application-dev/faqs/faqs-graphics.md
index 7eeba0644721dbf77174680f3c6c6d0ac0db05cf..9469a35736ef859342d2c24bdcb9780e94445bf8 100644
--- a/en/application-dev/faqs/faqs-graphics.md
+++ b/en/application-dev/faqs/faqs-graphics.md
@@ -1,90 +1,92 @@
-# Graphics and Image Development
+# Graphics Development
-## Why do the isStatusBarLightIcon and isNavigationBarLightIcon attributes not take effect when window.setSystemBarProperties() is called?
+## How do I obtain the DPI of a device?
-Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+Applicable to: OpenHarmony 3.2 Beta5 (API version 9, stage model)
-In effect, the **isStatusBarLightIcon** and **isNavigationBarLightIcon** attributes turn the font white when set to **true**. If **statusBarContentColor** is also set in **window.setSystemBarProperties()**, the **isStatusBarLightIcon** attribute does not take effect. Similarly, if **navigationBarContentColor** is set, the **isNavigationBarLightIcon** attribute does not take effect.
+**Solution**
-## How do I set the style of the system bar?
+Import the **@ohos.display** module and call the **getDefaultDisplaySync\(\)** API.
-Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
+**Example**
-Import the **\@ohos.window** module, and call **window.setSystemBarProperties()**.
+```
+import display from '@ohos.display';
+let displayClass = null;
+try {
+ displayClass = display.getDefaultDisplaySync();
+ console.info('Test densityDPI:' + JSON.stringify(displayClass.densityDPI));
+} catch (exception) {
+ console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
+}
+```
## How do I hide the status bar to get the immersive effect?
-Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
-
-1. Use the **onWindowStageCreate** to obtain a **windowClass** object.
-
- ```ts
- onWindowStageCreate(windowStage) {
- // When the main window is created, set the main page for this ability.
- console.log("[Demo] EntryAbility 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.
-
- ```ts
- 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));
- });
- ```
+Applicable to: OpenHarmony 3.2 Beta5 (API version 9, stage model)
+
+**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 SDK 3.2.3.5, stage model of API version 9
+Applicable to: OpenHarmony SDK 3.2 Beta5 (API version 9, stage model)
-Use **window.getProperties()** to obtain the window properties. The **windowRect** field in the properties specifies the window width and height.
+**Solution**
-Example:
+Import the **@ohos.window** module, obtain a **Window** object, and use **getWindowProperties\(\)** of the object to obtain the window properties. The **windowRect** field in the properties specifies the window width and height.
+**Example**
-```ts
-let promise = windowClass.getProperties();
-promise.then((data)=> {
- console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect));
-}).catch((err)=>{
- console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err));
-});
```
-
-## How do I set the color of the system bar?
-
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
-
-Refer to the following code:
-
-
-```ts
-window.getTopWindow(globalThis.mainContext).then(win => {
- var systemBarProperties = {
- statusBarColor: '#19B6FF', // Set the background color of the status bar.
- navigationBarColor: '#19B6FF', // Set the background color of the navigation bar.
- isStatusBarLightIcon: false, // Set the icon on the status bar not to be highlighted.
- isNavigationBarLightIcon: true, // Set the icon on the navigation bar to be highlighted.
- statusBarContentColor: '#0D0500', // Set the text color of the status bar.
- navigationBarContentColor: '#FFA500' // Set the text color of the navigation bar.
- };
- win.setSystemBarProperties(systemBarProperties).catch(err => {
- INDEX_LOGGER.info(`set System Bar Properties failed:${err}`)
- })
-})
-.catch(err => {
- INDEX_LOGGER.info(`get top window failed:${err}`)
-})
+import window from '@ohos.window';
+let windowClass = null;
+try {
+ let promise = window.getLastWindow(this.context);
+ promise.then((data)=> {
+ // Obtain a Window object.
+ windowClass = data;
+ try {
+ // Obtain the window properties.
+ let properties = windowClass.getWindowProperties();
+ let rect = properties.windowRect;
+ // rect.width: window width; rect.height: window height.
+ } catch (exception) {
+ console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(exception));
+ }
+ console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
+ }).catch((err)=>{
+ console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
+ });} catch (exception) {
+ console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception));
+}
```
diff --git a/en/application-dev/faqs/faqs-multimedia.md b/en/application-dev/faqs/faqs-multimedia.md
new file mode 100644
index 0000000000000000000000000000000000000000..080860a9a5ca913d1d40d9de049f9220a66118da
--- /dev/null
+++ b/en/application-dev/faqs/faqs-multimedia.md
@@ -0,0 +1,135 @@
+# Multimedia Development
+
+## How do I obtain the frame data of a camera when using the XComponent to display the preview output stream of the camera?
+
+Applicable to: OpenHarmony 3.2 (API version 9, stage model)
+
+**Symptom**
+
+Currently, the API does not support real-time preview of the camera frame data. To obtain the frame data, you must bind an action, for example, photographing.
+
+**Solution**
+
+Create a dual-channel preview to obtain the frame data.
+
+1. Use the XComponent to create a preview stream.
+
+ ```
+ // Obtain a PreviewOutput instance.
+ const surfaceId = globalThis.mxXComponentController.getXComponentSurfaceld();
+ this.mPreviewOutput = await Camera.createPreviewOutput(surfaceld) ;
+ ```
+
+2. Use imageReceiver to listen for image information.
+
+ ```
+ // Add dual-channel preview.
+ const fullWidth = this.mFullScreenSize.width;
+ const fullHeight = this.mFullScreenSize.height;
+ const imageReceiver = await image.createImageReceiver(fullwidth, fullHeight,
+ formatImage, capacityImage) ;
+ const photoSurfaceId = await imageReceiver.getReceivingSurfaceld();
+ this.mPreviewOutputDouble = await Camera.createPreviewOutput ( photoSurfaceld)
+ ```
+
+
+## How do I obtain the preview image of the front camera?
+
+Applicable to: OpenHarmony 3.2 (API version 9, stage model)
+
+**Solution**
+
+1. Use the **@ohos.multimedia.camera** module to obtain the physical camera information.
+
+ ```
+ let cameraManager = await camera.getCameraManager(context);
+ let camerasInfo = await cameraManager.getSupportedCameras();
+ let cameraDevice = this.camerasInfo[0];
+ ```
+
+2. Create and start the input stream channel of the physical camera.
+
+ ```
+ let cameraInput = await cameraManager.createCameraInput(cameraDevice);
+ await this.cameraInput.open();
+ ```
+
+3. Obtain the output formats supported by the camera, and create a preview output channel based on the surface ID provided by the XComponent.
+
+ ```
+ let outputCapability = await this.cameraManager.getSupportedOutputCapability(cameraDevice);
+ let previewProfile = this.outputCapability.previewProfiles[0];
+ let previewOutput = await cameraManager.createPreviewOutput(previewProfile, previewId);
+ ```
+
+4. Create a camera session, add the camera input stream and preview output stream to the session, and start the session. The preview image is displayed on the XComponent.
+
+ ```
+ let captureSession = await cameraManager.createCaptureSession();
+ await captureSession.beginConfig();
+ await captureSession.addInput(cameraInput);
+ await captureSession.addOutput(previewOutput);
+ await this.captureSession.commitConfig()
+ await this.captureSession.start();
+ ```
+
+
+## How do I set the camera focal length?
+
+Applicable to: OpenHarmony 3.2 (API version 9, stage model)
+
+**Solution**
+
+1. Check whether the camera is a front camera. A front camera does not support focal length setting.
+2. Use **captureSession.getZoomRatioRange\(\)** to obtain the focal length range supported by the device.
+3. Check whether the target focal length is within the range obtained. If yes, call **captureSession.setZoomRatio\(\)** to set the focal length.
+
+## How do I play music in the background?
+
+Applicable to: OpenHarmony 3.2 (API version 9, stage model)
+
+**Symptom**
+
+Music cannot be played in the background.
+
+**Solution**
+
+**AVSession** controls media playback. When a third-party application switches to the background or encounters a screen lock event, media playback is forcibly paused and the application is unaware of the pause. To enable the application to continue the playback in the background, request a continuous task and access the AVSession capability, which allows Control Panel to control the playback behavior of third-party applications.
+
+**Reference**
+
+[Continuous Task Development](../task-management/continuous-task-dev-guide.md)
+
+[AVSession Development](../media/using-avsession-developer.md)
+
+
+## What should I do when multiple video components cannot be used for playback?
+
+Applicable to: OpenHarmony 3.2 (API version 9, stage model)
+
+**Symptom**
+
+A large number of video components are created. They cannot play media normally or even crash.
+
+**Solution**
+
+A maximum of 13 media player instances can be created.
+
+
+## How do I invoke the image library directly?
+
+Applicable to: OpenHarmony 3.2 (API version 9, stage model)
+
+**Solution**
+
+```
+let want = {
+ bundleName: 'com.ohos.photos',
+ abilityName: 'com.ohos.photos.MainAbility',
+ parameters: {
+ uri: 'detail'
+ }
+};
+let context = getContext(this) as common.UIAbilityContext;
+context.startAbility(want);
+```
diff --git a/en/application-dev/faqs/faqs-security.md b/en/application-dev/faqs/faqs-security.md
new file mode 100644
index 0000000000000000000000000000000000000000..691739a0c288a3315e27e1f54700ba4e2637ddb3
--- /dev/null
+++ b/en/application-dev/faqs/faqs-security.md
@@ -0,0 +1,41 @@
+# Basic Security Capability Development
+
+## What is the maximum number of bytes that can be encrypted at a time in AES GCM mode in HUKS?
+
+Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
+
+**Solution**
+
+In HUKS, a maximum of 64 bytes can be encrypted at a time in AES GCM mode.
+
+**Example**
+
+```
+/* Encrypt the key. */
+await huks.init(srcKeyAlias, encryptOptions).then((data) => {
+ console.info(`test init data: ${JSON.stringify(data)}`);
+ handle = data.handle;
+}).catch((err) => {
+ console.info('test init err information: ' + JSON.stringify(err));
+});
+encryptOptions.inData = aesCipherStringToUint8Array(cipherInData.slice (0,64)); // Take 64 bytes.
+await huks.update(handle, encryptOptions).then(async (data) => {
+ console.info(`test update data ${JSON.stringify(data)}`);
+ encryptUpdateResult = Array.from(data.outData);
+}).catch((err) => {
+ console.info('test update err information: ' + err);
+});
+encryptOptions.inData = aesCipherStringToUint8Array(cipherInData.slice (64,80)); // Remaining data
+```
+
+## What if garbled characters are returned by **digest()** of **Md** in Crypto framework?
+
+Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
+
+**Symptom**
+
+In the CryptoFramework, garbled characters are returned by **digest()** of **Md**.
+
+**Solution**
+
+The DataBlob returned by **digest()** is of the Uint8Array type and needs to be converted into a hexadecimal string before being printed. You can use the online MD5 encryption tool to verify the result.
diff --git a/en/application-dev/faqs/faqs-sensor.md b/en/application-dev/faqs/faqs-sensor.md
new file mode 100644
index 0000000000000000000000000000000000000000..3932b223fb5c6af755c9eae019851e37edfa6ef4
--- /dev/null
+++ b/en/application-dev/faqs/faqs-sensor.md
@@ -0,0 +1,7 @@
+# Pan-Sensor Development
+
+## Are the APIs used for obtaining PPG and ECG sensor data open to individual developers?
+
+Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
+
+Data collected by the PPG and ECG sensors of wearable devices is personal privacy data. Therefore, relative APIs are not open to individual developers.
diff --git a/en/application-dev/faqs/faqs-third-fourth-party-library.md b/en/application-dev/faqs/faqs-third-fourth-party-library.md
index 898055cd200805d8df549b33bb2c5f3b4b05bca6..045a3f5efe77b0ad16b64960bbf015b62b07d46f 100644
--- a/en/application-dev/faqs/faqs-third-fourth-party-library.md
+++ b/en/application-dev/faqs/faqs-third-fourth-party-library.md
@@ -1,74 +1,69 @@
# Usage of Third- and Fourth-Party Libraries
-## What does the following error message mean: "Stage model module... does not support including OpenHarmony npm packages or modules in FA model. OpenHarmony build tasks will not be executed, and OpenHarmony resources will not be packed."
+## How do I obtain available third-party libraries?
-Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
-The third- and fourth-party libraries are not yet compatible with the stage model of API version 9 and cannot be used.
+The three-party and four-party libraries that can be obtained through ohpm are summarized in the [OpenHarmony-TPC/tpc_resource repository](https://gitee.com/openharmony-tpc/tpc_resource). You can access this repository, and find the desired component based on the directory index.
-## Can I transfer project-level dependencies?
+## Which third-party libraries are related to network requests?
-Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
-For example, if project A depends on project B and project B depends on project C, can project A directly use the APIs provided by project C?
+The following third-party libraries are related to network requests: [Axios](https://gitee.com/openharmony-sig/axios), httpclient, and okdownload. For details, see the [OpenHarmony-TPC/tpc_resource repository](https://gitee.com/openharmony-tpc/tpc_resource).
-No. Project A cannot directly use the APIs provided by project C. The project packing tool NPM does not support dependency transfer. To use the APIs provided by project C, you can add the dependency of project C to project A.
+## How do I use ohpm to import third- and fourth-party libraries?
-## How do I obtain available third-party libraries?
+Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
-Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9
+**Solution**
-For details, see [Third-Party Components That Can Be Directly Used on OpenHarmony](https://gitee.com/openharmony-sig/third_party_app_libs).
+- Method 1:
+ 1. Open the **Terminal** window and run the following command to go to the **entry** directory:
-## Which third-party libraries are related to network requests?
+ ```
+ cd entry
+ ```
+
+ 2. Run the following command to install a third-party library, for example, **dayjs**:
+
+ ```
+ ohpm install dayjs
+ ```
+
+ 3. Add the following statement in the .js file to import the third-party library:
+
+ ```
+ import dayjs from 'dayjs';
+ ```
-Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9
-
-The [Axios](https://gitee.com/openharmony-sig/axios) library is related to network requests.
-
-## How do I use NPM to import third- and fourth-party libraries?
-
-Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
-- Method 1:
- 1. Open the **Terminal** window and run the following command to go to the **entry** directory:
-
- ```
- cd entry
- ```
- 2. Run the following command to install a third-party package, for example, **dayjs**:
-
- ```
- npm install dayjs --save
- ```
- 3. Add the following statement in the .js file to import the package:
-
- ```
- import dayjs from 'dayjs';
- ```
-
-- Method 2:
- 1. Enter the **entry** directory of the project and open the **package.json** file.
- 2. Write the third-party NPM package to be installed (for example, **dayjs**) in the **package.json** file.
-
- ```
- {
- "dependencies": {
- "dayjs": "^1.10.4",
+
+- Method 2:
+ 1. Enter the **entry** directory of the project and open the **oh-package.json5** file.
+ 2. Write the third-party library to be installed (for example, **dayjs**) in the **oh-package.json5** file.
+
+ ```
+ {
+ "dependencies": {
+ "dayjs": "^1.10.4",
+ }
}
- }
- ```
- 3. Open the **Terminal** window and run the following command to go to the **entry** directory:
-
- ```
- cd entry
- ```
- 4. Run the following command to install NPM:
-
- ```
- npm install
- ```
- 5. Add the following statement in the .js file to import the package:
-
- ```
- import dayjs from 'dayjs';
- ```
+ ```
+
+ 3. Open the **Terminal** window and run the following command to go to the **entry** directory:
+
+ ```
+ cd entry
+ ```
+
+ 4. Run the following command to install the third-party library:
+
+ ```
+ ohpm install
+ ```
+
+ 5. Add the following statement in the .js file to import the third-party library:
+
+ ```
+ import dayjs from 'dayjs';
+ ```
diff --git a/en/application-dev/faqs/faqs-window-manager.md b/en/application-dev/faqs/faqs-window-manager.md
new file mode 100644
index 0000000000000000000000000000000000000000..7368ec7cbb95ee0235810464d822554cf2b1880d
--- /dev/null
+++ b/en/application-dev/faqs/faqs-window-manager.md
@@ -0,0 +1,64 @@
+# Window Management Development
+
+## How do I obtain the height of the status bar and navigation bar?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+Before the window content is loaded, enable listening for the **systemAvoidAreaChange** event.
+
+**Example**
+
+```
+// MainAbility.ts
+import window from '@ohos.window';
+
+/**
+ * Set the immersive window and obtain the height of the status bar and navigation bar.
+ * @param mainWindow Indicates the main window.
+ */
+async function enterImmersion(mainWindow: window.Window) {
+ mainWindow.on("systemBarTintChange", (data) => {
+ let avoidAreaRect = data.regionTint[0].region; // data.regionTint is an array that contains the rectangle coordinates of the status bar and navigation bar.
+ })
+ await mainWindow.setFullScreen(true)
+ await mainWindow.setSystemBarEnable(["status", "navigation"])
+ await mainWindow.systemBarProperties({
+ navigationBarColor: "#00000000",
+ statusBarColor: "#00000000",
+ navigationBarContentColor: "#FF0000",
+ statusBarContentColor: "#FF0000"
+ })
+}
+export default class MainAbility extends Ability {
+ // Do something.
+ async onWindowStageCreate(windowStage: window.WindowStage) {
+ let mainWindow = await windowStage.getMainWindow()
+ await enterImmersion(mainWindow)
+ windowStage.loadContent('pages/index')
+ }
+ // Do something.
+}
+```
+
+## How do I hide the status bar on the top of an application?
+
+Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
+
+**Solution**
+
+Use **setWindowSystemBarEnable** in the **onWindowStageCreate** lifecycle callback of UIAbility.
+
+**Example**
+
+```
+onWindowStageCreate(windowStage){
+ windowStage.getMainWindowSync().setWindowSystemBarEnable([])
+ ......
+}
+```
+
+**Reference**
+
+[Window](../reference/apis/js-apis-window.md)
diff --git a/en/application-dev/file-management/app-sandbox-directory.md b/en/application-dev/file-management/app-sandbox-directory.md
index 7d06b330aa085aa34045c5491b5855160744f44a..3424dfbc9ec457e5ab6839e521fde5caad0dd3ae 100644
--- a/en/application-dev/file-management/app-sandbox-directory.md
+++ b/en/application-dev/file-management/app-sandbox-directory.md
@@ -73,7 +73,7 @@ The following figure shows the application file directories. The path of a file
| distributedfiles | distributedFilesDir | Distributed file directory| Directory in **el2** for saving the application files that can be directly accessed across devices. This directory is cleared when the application is uninstalled.|
| files | filesDir | Application file directory| Directory for saving the application's persistent files on the device. This directory is cleared when the application is uninstalled.|
| cache | cacheDir | Application cache file directory| Directory for caching the downloaded files of the application or saving the cache files regenerated on the device. This directory is automatically cleared when the size of the **cache** directory reaches the quota or the system storage space reaches a certain threshold. The user can also clear this directory by using a system space management application. The application needs to check whether the file still exists and determine whether to cache the file again.|
- | preferences | preferencesDir | Preferences file directory| Directory for saving common application configuration and user preference data managed by using database APIs. This directory is cleared when the application is uninstalled. For details, see [Data Persistence by User Preferences](../database/data-persistence-by-preferences.md).|
+ | preferences | preferencesDir | Preferences file directory| Directory for saving common application configuration and user preference data managed by using database APIs. This directory is cleared when the application is uninstalled. For details, see [Persisting Preferences Data](../database/data-persistence-by-preferences.md).|
| temp | tempDir | Temporary file directory| Directory for saving the files generated and required during the application's runtime on the device. This directory is cleared when the application exits.|
The application file paths are used in the following scenarios:
@@ -92,5 +92,3 @@ The following figure shows the application file directories. The path of a file
Used to store application preferences data, including preference files and configuration files. This directory applied to storing only a small amount of data.
- Temporary file directory
Used to store temporarily generated data of an application, including cached database data and images, temporary log files, downloaded application installation package files. The data stored in this directory is deleted after being used.
-
-
\ No newline at end of file
diff --git a/en/application-dev/file-management/file-management-overview.md b/en/application-dev/file-management/file-management-overview.md
index a159a3348eb7892a68a334c64ae0b69288e24d1d..2fbd4b4a036de1f20f8aa64825ab1dcb60f23414 100644
--- a/en/application-dev/file-management/file-management-overview.md
+++ b/en/application-dev/file-management/file-management-overview.md
@@ -23,6 +23,3 @@ The file systems can be classified into the following types based on the file st
**Figure 1** Files in an OS

-
-
-
\ No newline at end of file
diff --git a/en/application-dev/file-management/select-user-file.md b/en/application-dev/file-management/select-user-file.md
index 77fc2dd23c080c357d1749df4bb3ca551cba3a0d..c87015b50235ff9c54721668c019caea9119a5ae 100644
--- a/en/application-dev/file-management/select-user-file.md
+++ b/en/application-dev/file-management/select-user-file.md
@@ -63,7 +63,11 @@ The **FilePicker** provides the following interfaces by file type:
```
3. Create a **documentViewPicker** instance, and call [**select()**](../reference/apis/js-apis-file-picker.md#select-3) to open the **FilePicker** page for the user to select documents.
+
After the documents are selected successfully, a result set containing the file URIs is returned. Further operations can be performed on the documents based on the file URIs.
+
+ For example, you can use [file management APIs](../reference/apis/js-apis-file-fs.md) to obtain file attribute information, such as the file size, access time, and last modification time, based on the URI. If you need to obtain the file name, use [startAbilityForResult](../../application-dev/application-models/uiability-intra-device-interaction.md).
+
> **NOTE**
>
> Currently, **DocumentSelectOptions** is not configurable. By default, all types of user files are selected.
@@ -80,6 +84,32 @@ The **FilePicker** provides the following interfaces by file type:
})
```
+ > **NOTE**
+ >
+ > Currently, **DocumentSelectOptions** does not provide the method for obtaining the file name. To obtain the file name, use **startAbilityForResult()**.
+
+ ```ts
+ let config = {
+ action: 'ohos.want.action.OPEN_FILE',
+ parameters: {
+ startMode: 'choose',
+ }
+ }
+ try {
+ let result = await context.startAbilityForResult(config, {windowMode: 1});
+ if (result.resultCode !== 0) {
+ console.error(`DocumentPicker.select failed, code is ${result.resultCode}, message is ${result.want.parameters.message}`);
+ return;
+ }
+ // Obtain the URI of the document.
+ let select_item_list = result.want.parameters.select_item_list;
+ // Obtain the name of the document.
+ let file_name_list = result.want.parameters.file_name_list;
+ } catch (err) {
+ console.error(`Invoke documentPicker.select failed, code is ${err.code}, message is ${err.message}`);
+ }
+ ```
+
## Selecting an Audio File
1. Import the **FilePicker** module.
diff --git a/en/application-dev/file-management/set-security-label.md b/en/application-dev/file-management/set-security-label.md
index 94ad527767e443b532330e207a45653980cdfa71..af819fba397d47f81b0ebe005e67f9e6c8ebef39 100644
--- a/en/application-dev/file-management/set-security-label.md
+++ b/en/application-dev/file-management/set-security-label.md
@@ -1,6 +1,6 @@
# Setting the Security Level of a Distributed File
-The security capabilities vary with devices. For example, small embedded devices provide fewer security capabilities than tablets. The security requirements also vary with data. For example, personal health information and bank card information are not expected to be accessed by devices of lower security levels. OpenHarmony provides a complete set of standards for data and device classification and custom data transfer policies for different devices. For details, see [Data and Device Security Classification](../database/access-control-by-device-and-data-level.md).
+The security capabilities vary with devices. For example, small embedded devices provide fewer security capabilities than tablets. The security requirements also vary with data. For example, personal health information and bank card information are not expected to be accessed by devices of lower security levels. OpenHarmony provides a complete set of standards for data and device classification and custom data transfer policies for different devices. For details, see [Data Security Labels and Device Security Levels](../database/access-control-by-device-and-data-level.md).
## Available APIs
@@ -39,4 +39,3 @@ securityLabel.setSecurityLabel(filePath, 's0').then(() => {
console.error(`Failed to setSecurityLabel. Code: ${err.code}, message: ${err.message}`);
});
```
-
\ No newline at end of file
diff --git a/en/application-dev/file-management/share-app-file.md b/en/application-dev/file-management/share-app-file.md
index d9ee1d90904f5cdb43cd1987a66b09668200bc81..4261861bad51dc312d0ccfc5ab0a7f4d8f404426 100644
--- a/en/application-dev/file-management/share-app-file.md
+++ b/en/application-dev/file-management/share-app-file.md
@@ -6,13 +6,13 @@ The file of an application can be shared with another application based on the f
- You can also use **open()** of the ohos.file.fs module to share an application file with the specified permissions to another application based on the FD. After parsing the FD from **Want**, the target application can read and write the file by using **read()** and **write()** APIs of ohos.file.fs.
-You can use the related APIs to [share a file with another application](#sharing-a-file-with-another-application) or [use shared application files](#using-shared-files).
+You can use the related APIs to [share a file with another application](#sharing-a-file-with-another-application) or [use shared application files](#using-shared-application-files).
## File URI Specifications
The file URIs are in the following format:
- file://<bundleName>/<path>/\#networkid=<networkid>
+ file://<bundleName>/<path>
- **file**: indicates a file URI.
@@ -20,8 +20,6 @@ The file URIs are in the following format:
- *path*: specifies the application sandbox path of the file.
-- *networkid* (optional): specifies the device to which the file belongs in a distributed file system. Leave this parameter unspecified if the file location does not need to be set.
-
## Sharing a File with Another Application
Before sharing application files, you need to [obtain the application file path](../application-models/application-context-stage.md#obtaining-the-application-development-path).
diff --git a/en/application-dev/media/using-avsession-developer.md b/en/application-dev/media/using-avsession-developer.md
index 07bd4bf1297f3afc5352d30e9acd674fe056f815..077f0b956a5fb6abaf26c647132bdbb81e78fc63 100644
--- a/en/application-dev/media/using-avsession-developer.md
+++ b/en/application-dev/media/using-avsession-developer.md
@@ -88,7 +88,7 @@ To enable an audio and video application to access the AVSession service as a pr
```ts
// It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet above.
let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION;
- let wantAgentInfo: {
+ let wantAgentInfo = {
wants: [
{
bundleName: "com.example.musicdemo",
diff --git a/en/application-dev/quick-start/arkts-basic-syntax-overview.md b/en/application-dev/quick-start/arkts-basic-syntax-overview.md
index 59dd8e9e0ebb02f4f76b59985fe45e2e6b1f4cdd..885acf30122e0b2971ee51a4e0f399f63ab0f1c2 100644
--- a/en/application-dev/quick-start/arkts-basic-syntax-overview.md
+++ b/en/application-dev/quick-start/arkts-basic-syntax-overview.md
@@ -23,9 +23,9 @@ In this example, the basic composition of ArkTS is as follows.
- [Custom component](arkts-create-custom-components.md): reusable UI unit, which can be combined with other components, such as the struct **Hello** decorated by @Component.
-- Built-in component: default basic or container component preset in ArkTS, which can be directly invoked, such as** \**,** \**, **\**, and **\
- **shown**: icon of the control button when the sidebar is shown. - **hidden**: icon of the control button when the sidebar is hidden. - **switching**: icon of the control button when the sidebar is switching between the shown and hidden states.|
+| left | number | No| Spacing between the sidebar control button and the left of the container. Default value: **16** Unit: vp|
+| top | number | No| Spacing between the sidebar control button and the top of the container. Default value: **48** Unit: vp|
+| width | number | No| Width of the sidebar control button. Default value: **32** Unit: vp|
+| height | number | No| Height of the sidebar control button. Default value: **32** Unit: vp|
+| icons | { shown: string \| PixelMap \| [Resource](ts-types.md) , hidden: string \| PixelMap \| [Resource](ts-types.md) , switching?: string \| PixelMap \| [Resource](ts-types.md) } | No| Icons of the sidebar control button. - **shown**: icon of the control button when the sidebar is shown. **NOTE** When an error occurs during resource obtaining, the default icon is used. - **hidden**: icon of the control button when the sidebar is hidden. - **switching**: icon of the control button when the sidebar is switching between the shown and hidden states.|
## SideBarPosition9+
@@ -61,9 +69,11 @@ SideBarContainer( type?: SideBarContainerType )
## Events
+In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
+
| Name| Description|
| -------- | -------- |
-| onChange(callback: (value: boolean) => void) | Triggered when the status of the sidebar switches between shown and hidden.
The value **true** means that the sidebar is shown, and **false** means the opposite.|
+| onChange(callback: (value: boolean) => void) | Triggered when the status of the sidebar switches between shown and hidden. The value **true** means that the sidebar is displayed, and **false** means the opposite. This event is triggered when any of the following conditions is met: 1. The value of **showSideBar** changes. 2. The **showSideBar** attribute adapts to behavior changes. 3. The **autoHide** API is triggered when the divider is dragged.|
## Example
@@ -73,14 +83,13 @@ SideBarContainer( type?: SideBarContainerType )
@Entry
@Component
struct SideBarContainerExample {
- normalIcon : Resource = $r("app.media.icon")
+ normalIcon: Resource = $r("app.media.icon")
selectedIcon: Resource = $r("app.media.icon")
@State arr: number[] = [1, 2, 3]
@State current: number = 1
build() {
- SideBarContainer(SideBarContainerType.Embed)
- {
+ SideBarContainer(SideBarContainerType.Embed) {
Column() {
ForEach(this.arr, (item, index) => {
Column({ space: 5 }) {
@@ -105,6 +114,13 @@ struct SideBarContainerExample {
}
.margin({ top: 50, left: 20, right: 30 })
}
+ .controlButton({
+ icons: {
+ hidden: $r('app.media.drawer'),
+ shown: $r('app.media.drawer'),
+ switching: $r('app.media.drawer')
+ }
+ })
.sideBarWidth(150)
.minSideBarWidth(50)
.maxSideBarWidth(300)
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 2f224afc0377281c20ee36a638b5862a39096106..7cd62c1323780d8ea22835b7ae8cdebac7952a5b 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-swiper.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-swiper.md
@@ -11,6 +11,10 @@
This component can contain child components.
+> **NOTE**
+>
+> Built-in components and custom components are allowed, with support for ([if/else](../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)) rendering control.
+
## APIs
@@ -29,21 +33,21 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type | Description |
| --------------------------- | ---------------------------------------- | ---------------------------------------- |
-| index | number | Index of the child component currently displayed in the container. Default value: **0** |
-| autoPlay | boolean | Whether to enable automatic playback for child component switching. Default value: **false** |
+| index | number | Index of the child component currently displayed in the container. Default value: **0** **NOTE** If the value is less than 0 or greater than or equal to the number of child components, the default value **0** is used. Since API version 10, this attribute supports [$$](../../quick-start/arkts-two-way-sync.md) for two-way binding of variables.|
+| autoPlay | boolean | Whether to enable automatic playback for child component switching. Default value: **false** **NOTE** If **loop** is set to **false**, the rotation stops when the last page is displayed. The playback continues when the page is not the last page after a swipe gesture. |
| interval | number | Interval for automatic playback, in ms. Default value: **3000** |
| indicator | boolean | Whether to enable the navigation dots indicator. Default value: **true** |
| loop | boolean | Whether to enable loop playback. The value **true** means to enable loop playback. When LazyForEach is used, it is recommended that the number of the components to load exceed 5. Default value: **true**|
| duration | number | Duration of the animation for switching child components, in ms. Default value: **400** |
| vertical | boolean | Whether vertical swiping is used. Default value: **false** |
-| itemSpace | number \| string | Space between child components. Default value: **0** |
+| itemSpace | number \| string | Space between child components. Default value: **0** **NOTE** This parameter cannot be set in percentage.|
| displayMode | SwiperDisplayMode | Mode in which elements are displayed along the main axis. This attribute takes effect only when **displayCount** is not set. Default value: **SwiperDisplayMode.Stretch**|
| cachedCount8+ | number | Number of child components to be cached. Default value: **1** |
| disableSwipe8+ | boolean | Whether to disable the swipe feature. Default value: **false** |
| curve8+ | [Curve](ts-appendix-enums.md#curve) \| string | Animation curve. The ease-in/ease-out curve is used by default. For details about common curves, see [Curve](ts-appendix-enums.md#curve). You can also create custom curves (interpolation curve objects) by using the API provided by the [interpolation calculation](../apis/js-apis-curve.md) module. Default value: **Curve.Ease**|
| indicatorStyle8+ | { left?: [Length](ts-types.md#length), top?: [Length](ts-types.md#length), right?: [Length](ts-types.md#length), bottom?: [Length](ts-types.md#length), size?: [Length](ts-types.md#length), mask?: boolean, color?: [ResourceColor](ts-types.md), selectedColor?: [ResourceColor](ts-types.md) } | Style of the navigation dots indicator. \- **left**: distance between the navigation dots indicator and the left edge of the **\** component. \- **top**: distance between the navigation dots indicator and the top edge of the **\** component. \- **right**: distance between the navigation dots indicator and the right edge of the **\** component. \- **bottom**: distance between the navigation dots indicator and the bottom edge of the **\** component. \- **size**: diameter of the navigation dots indicator. \- **mask**: whether to enable the mask for the navigation dots indicator. \- **color**: color of the navigation dots indicator. \- **selectedColor**: color of the selected navigation dot.|
-| displayCount8+ | number\|string | Number of elements to display per page. Default value: **1** |
-| effectMode8+ | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Swipe effect. For details, see **EdgeEffect**. Default value: **EdgeEffect.Spring**|
+| displayCount8+ | number\|string | Number of elements to display per page. Default value: **1** |
+| effectMode8+ | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Swipe effect. For details, see **EdgeEffect**. Default value: **EdgeEffect.Spring** |
## SwiperDisplayMode
@@ -60,13 +64,13 @@ Controller of the **\** component. You can bind this object to the **\ void | No | Callback invoked when the animation stops.|
-## Events
-
-### onChange
-
-onChange(event: (index: number) => void)
-Triggered when the index of the currently displayed child component changes.
-
-> **NOTE**
->
-> When the **\** component is used together with **LazyForEach**, the subpage UI cannot be refreshed in the **onChange** event.
-
-**Return value**
+## Events
-| Name | Type | Description|
-| --------- | ---------- | -------- |
-| index | number | Index of the currently displayed element.|
+In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
+| Name | Description |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+| onChange(event: (index: number) => void) | Triggered when the index of the currently displayed child component changes. - **index**: index of the currently displayed element. **NOTE** When the **\** component is used together with **LazyForEach**, the subpage UI update cannot be triggered in the **onChange** event.|
+| onAnimationStart9+(event: (index: number) => void) | Triggered when the switching animation starts. - **index**: index of the currently displayed element. **NOTE** The **index** parameter indicates the index before the animation starts (not the one after). When the **\** component contains multiple columns, the index is of the leftmost element.|
+| onAnimationEnd9+(event: (index: number) => void) | Triggered when the switching animation ends. - **index**: index of the currently displayed element. **NOTE** This event is triggered when the animation ends regardless of whether it is due to a user gesture or invocation of **finishAnimation** through **SwiperController**. The **index** parameter indicates the index after the animation ends. When the **\** component contains multiple columns, the index is of the leftmost element.|
## Example
diff --git a/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md b/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md
index ff7e048c992348673f69adf93414d58a841f52f8..34f2591ee877919152d8f502c916d78ef450154e 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md
@@ -13,7 +13,8 @@ This component supports only one child component.
> **NOTE**
>
-> System components and custom components can be built in, and rendering control types ([if/else](../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)) are supported.
+> Built-in components and custom components are allowed, with support for ([if/else](../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)) rendering control.
+
## APIs
@@ -26,14 +27,15 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Description|
| -------- | -------- | -------- |
-| tabBar | string \| Resource \| { icon?: string \| Resource, text?: string \| Resource } \| [CustomBuilder](ts-types.md)8+ | Content displayed on the tab bar. **CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions). **NOTE** If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image. |
-| tabBar9+ | [SubTabBarStyle](#subtabbarstyle9) \| [BottomTabBarStyle](#bottomtabbarstyle9) | Content displayed on the tab bar. **SubTabBarStyle**: subtab style. It takes text as its input parameter. **BottomTabBarStyle**: bottom and side tab style. It takes text and images as its input parameters.|
+| tabBar | string \| Resource \| { icon?: string \| Resource, text?: string \| Resource } \| [CustomBuilder](ts-types.md)8+ | Content displayed on the tab bar. **CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions). **NOTE** If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image. If the content set exceeds the space provided by the tab bar, it will be clipped.|
+| tabBar9+ | [SubTabBarStyle](#subtabbarstyle9) \| [BottomTabBarStyle](#bottomtabbarstyle9) | Content displayed on the tab bar. **SubTabBarStyle**: subtab style. It takes text as its input parameter. **BottomTabBarStyle**: bottom and side tab style. It takes text and images as its input parameters. **NOTE** The bottom tab style does not include an underline. When an icon display error occurs, a gray blank block is displayed.|
> **NOTE**
-> - The **\** component does not support setting of the common width attribute. By default, its width is the same as that of the parent **\** component.
-> - The **\** component does not support setting of the common height attribute. Its height is determined by the height of the parent **\** component and the **\** component.
+>
+> - The **\** component does not support setting of the common width attribute. By default, its width is the same as that of the parent **\** component.
+> - The **\** component does not support setting of the common height attribute. Its height is determined by the height of the parent **\** component and the **\** component.
> - If the **vertical** attribute is **false**, the width and height descriptions are swapped in the preceding two restrictions.
-> - **\** does not support page scrolling. If page scrolling is required, consider nesting a list.
+> - **\** does not support page scrolling. If page scrolling is required, consider nesting a list.
## SubTabBarStyle9+
@@ -49,7 +51,8 @@ Constructor used to create a **SubTabBarStyle** instance.
| Name| Type | Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| content | string \| [Resource](ts-types.md#resource) | Yes| Text for the tab.|
+| content | string \| [Resource](ts-types.md#resource) | Yes| Text for the tab. Since API version 10, the type of **content** is **ResourceStr**.|
+
## BottomTabBarStyle9+
@@ -65,8 +68,9 @@ A constructor used to create a **BottomTabBarStyle** instance.
| Name| Type | Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| icon | string \| [Resource](ts-types.md#resource) | Yes| Image for the tab.|
-| text | string \| [Resource](ts-types.md#resource) | Yes| Text for the tab.|
+| icon | string \| [Resource](ts-types.md#resource) | Yes| Image for the tab. Since API version 10, the type of **icon** is **ResourceStr**.|
+| text | string \| [Resource](ts-types.md#resource) | Yes| Text for the tab. Since API version 10, the type of **text** is **ResourceStr**.|
+
## Example
diff --git a/en/application-dev/reference/arkui-ts/ts-container-tabs.md b/en/application-dev/reference/arkui-ts/ts-container-tabs.md
index e7d048e01f1d75095485d79e689d29ef6090c276..1d6faaf26b82ba9f31cbf9e659c2acee4e1f5d56 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-tabs.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-tabs.md
@@ -18,11 +18,11 @@ Tabs(value?: {barPosition?: BarPosition, index?: number, controller?: [TabsContr
**Parameters**
-| Name | Type | Mandatory | Description |
-| ----------- | --------------------------------- | ---- | ---------------------------------------- |
-| barPosition | BarPosition | No | Position of the **\** component. Default value: **BarPosition.Start** |
-| index | number | No | Initial tab index. Default value: **0** **NOTE**
A value less than 0 evaluates to the default value. The value ranges from 0 to the number of **\** subnodes minus 1. When this parameter is set to different values, the slide animation for tab switching is enabled by default. To disable the animation, set **animationDuration** to **0**.|
-| controller | [TabsController](#tabscontroller) | No | Tab controller. |
+| Name | Type | Mandatory| Description |
+| ----------- | --------------------------------- | ---- | ------------------------------------------------------------ |
+| barPosition | BarPosition | No | Position of the **\** component. Default value: **BarPosition.Start** |
+| index | number | No | Initial tab index. Default value: **0** **NOTE** A value less than 0 evaluates to the default value. The value ranges from 0 to the number of **\** subnodes minus 1. When this parameter is set to different values, the slide animation for tab switching is enabled by default. To disable the animation, set **animationDuration** to **0**. |
+| controller | [TabsController](#tabscontroller) | No | Tab controller. |
## BarPosition
@@ -147,4 +147,3 @@ struct TabsExample {
```

-
\ No newline at end of file
diff --git a/en/application-dev/reference/arkui-ts/ts-container-waterflow.md b/en/application-dev/reference/arkui-ts/ts-container-waterflow.md
new file mode 100644
index 0000000000000000000000000000000000000000..76507f08dfd3debfb83504d54ce4344e870e0524
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-container-waterflow.md
@@ -0,0 +1,291 @@
+# WaterFlow
+
+
+The **\** component is a container that consists of cells formed by rows and columns and arranges items of different sizes from top to bottom according to the preset rules.
+
+
+> **NOTE**
+>
+> This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.
+
+
+## Child Components
+
+
+The [\](ts-container-flowitem.md) child component is supported.
+
+
+## APIs
+
+
+WaterFlow(options?: {footer?: CustomBuilder, scroller?: Scroller})
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ----------------------------------------------- | ------ | -------------------------------------------- |
+| footer | [CustomBuilder](ts-types.md#custombuilder8) | No | Footer of the **\** component. |
+| scroller | [Scroller](ts-container-scroll.md#scroller) | No | Controller, which can be bound to scrollable components. The **\** component supports only the **scrollToIndex** API of the **\** component.|
+
+
+## Attributes
+
+
+In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
+
+| Name| Type| Description|
+| -------- | -------- | -------- |
+| columnsTemplate | string | Number of columns in the layout. If this attribute is not set, one column is used by default. For example, **'1fr 1fr 2fr'** indicates three columns, with the first column taking up 1/4 of the parent component's full width, the second column 1/4, and the third column 2/4. This attribute supports [auto-fill](#auto-fill). Default value: **'1fr'**|
+| rowsTemplate | string | Number of rows in the layout. If this attribute is not set, one row is used by default. For example, **'1fr 1fr 2fr'** indicates three rows, with the first row taking up 1/4 of the parent component's full height, the second row 1/4, and the third row 2/4. This attribute supports [auto-fill](#auto-fill). Default value: **'1fr'**|
+| itemConstraintSize | [ConstraintSizeOptions](ts-types.md#constraintsizeoptions) | Size constraints of the child components during layout. |
+| columnsGap | Length |Gap between columns. Default value: **0**|
+| rowsGap | Length |Gap between rows. Default value: **0**|
+| layoutDirection | [FlexDirection](ts-appendix-enums.md#flexdirection) |Main axis direction of the layout. Default value: **FlexDirection.Column**|
+
+The priority of **layoutDirection** is higher than that of **rowsTemplate** and **columnsTemplate**. Depending on the **layoutDirection** settings, there are three layout modes:
+
+- **layoutDirection** is set to **FlexDirection.Column** or **FlexDirection.ColumnReverse**
+
+ In this case, **columnsTemplate** is valid. If it is not set, the default value is used. For example, if **columnsTemplate** is set to **"1fr 1fr"** and **rowsTemplate** **"1fr 1fr 1fr"**, child components are arranged in vertical layout, with the cross axis equally divided into two columns.
+
+- **layoutDirection** set to **FlexDirection.Row** or **FlexDirection.RowReverse**
+
+ In this case, **rowsTemplate** is valid. If it is not set, the default value is used. For example, if **columnsTemplate** is set to **"1fr 1fr"** and **rowsTemplate** **"1fr 1fr 1fr"**, child components are arranged in horizontal layout, with the cross axis equally divided into three columns.
+
+- **layoutDirection** is not set
+
+ In this case, the default value of **layoutDirection** is used, which is **FlexDirection.Column**, and **columnsTemplate** is valid. For example, if **columnsTemplate** is set to **"1fr 1fr"** and **rowsTemplate** **"1fr 1fr 1fr"**, child components are arranged in vertical layout, with the cross axis equally divided into two columns.
+
+## Events
+
+
+In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
+
+
+| Name| Description|
+| -------- | -------- |
+| onReachStart(event: () => void) | Triggered when the component reaches the start.|
+| onReachEnd(event: () => void) | Triggered when the component reaches the end.|
+
+
+## auto-fill
+
+The **columnsTemplate** and **rowsTemplate** attributes supports **auto-fill** in the following format:
+
+```css
+repeat(auto-fill, track-size)
+```
+
+Where, **repeat** and **auto-fill** are keywords, and **track-size** indicates the row height or column width. The supported units include px, vp, %, and digits. The value of **track-size** must contain at least one valid row height or column width.
+
+
+## Example
+
+
+```ts
+// WaterFlowDataSource.ets
+
+// Object that implements the IDataSource API, which is used by the component to load data.
+export class WaterFlowDataSource implements IDataSource {
+
+ private dataArray: number[] = []
+ private listeners: DataChangeListener[] = []
+
+ constructor() {
+ for (let i = 0; i < 100; i++) {
+ this.dataArray.push(i)
+ }
+ }
+
+ // Obtain the data corresponding to the specified index.
+ public getData(index: number): any {
+ return this.dataArray[index]
+ }
+
+ // Notify the controller of data reloading.
+ notifyDataReload(): void {
+ this.listeners.forEach(listener => {
+ listener.onDataReloaded()
+ })
+ }
+
+ // Notify the controller of data addition.
+ notifyDataAdd(index: number): void {
+ this.listeners.forEach(listener => {
+ listener.onDataAdded(index)
+ })
+ }
+
+ // Notify the controller of data changes.
+ notifyDataChange(index: number): void {
+ this.listeners.forEach(listener => {
+ listener.onDataChanged(index)
+ })
+ }
+
+ // Notify the controller of data deletion.
+ notifyDataDelete(index: number): void {
+ this.listeners.forEach(listener => {
+ listener.onDataDeleted(index)
+ })
+ }
+
+ // Notify the controller of the data location change.
+ notifyDataMove(from: number, to: number): void {
+ this.listeners.forEach(listener => {
+ listener.onDataMoved(from, to)
+ })
+ }
+
+ // Obtain the total number of data records.
+ public totalCount(): number {
+ return this.dataArray.length
+ }
+
+ // Register the data change listener.
+ registerDataChangeListener(listener: DataChangeListener): void {
+ if (this.listeners.indexOf(listener) < 0) {
+ this.listeners.push(listener)
+ }
+ }
+
+ // Unregister the data change listener.
+ unregisterDataChangeListener(listener: DataChangeListener): void {
+ const pos = this.listeners.indexOf(listener)
+ if (pos >= 0) {
+ this.listeners.splice(pos, 1)
+ }
+ }
+
+ // Add data.
+ public Add1stItem(): void {
+ this.dataArray.splice(0, 0, this.dataArray.length)
+ this.notifyDataAdd(0)
+ }
+
+ // Add an item to the end of the data.
+ public AddLastItem(): void {
+ this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length)
+ this.notifyDataAdd(this.dataArray.length-1)
+ }
+
+ // Add an item to the position corresponding to the specified index.
+ public AddItem(index: number): void {
+ this.dataArray.splice(index, 0, this.dataArray.length)
+ this.notifyDataAdd(index)
+ }
+
+ // Delete the first item.
+ public Delete1stItem(): void {
+ this.dataArray.splice(0, 1)
+ this.notifyDataDelete(0)
+ }
+
+ // Delete the second item.
+ public Delete2ndItem(): void {
+ this.dataArray.splice(1, 1)
+ this.notifyDataDelete(1)
+ }
+
+ // Delete the last item.
+ public DeleteLastItem(): void {
+ this.dataArray.splice(-1, 1)
+ this.notifyDataDelete(this.dataArray.length)
+ }
+
+ // Reload data.
+ public Reload(): void {
+ this.dataArray.splice(1, 1)
+ this.dataArray.splice(3, 2)
+ this.notifyDataReload()
+ }
+}
+```
+
+```ts
+// WaterflowDemo.ets
+import { WaterFlowDataSource } from './WaterFlowDataSource'
+
+@Entry
+@Component
+struct WaterflowDemo {
+ @State minSize: number = 50
+ @State maxSize: number = 100
+ @State fontSize: number = 24
+ @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
+ scroller: Scroller = new Scroller()
+ datasource: WaterFlowDataSource = new WaterFlowDataSource()
+ private itemWidthArray: number[] = []
+ private itemHeightArray: number[] = []
+
+ // Calculate the width and height of a flow item.
+ getSize() {
+ let ret = Math.floor(Math.random() * this.maxSize)
+ return (ret > this.minSize ? ret : this.minSize)
+ }
+
+ // Save the width and height of the flow item.
+ getItemSizeArray() {
+ for (let i = 0; i < 100; i++) {
+ this.itemWidthArray.push(this.getSize())
+ this.itemHeightArray.push(this.getSize())
+ }
+ }
+
+ aboutToAppear() {
+ this.getItemSizeArray()
+ }
+
+ @Builder itemFoot() {
+ Column() {
+ Text(`Footer`)
+ .fontSize(10)
+ .backgroundColor(Color.Red)
+ .width(50)
+ .height(50)
+ .align(Alignment.Center)
+ .margin({ top: 2 })
+ }
+ }
+
+ build() {
+ Column({ space: 2 }) {
+ WaterFlow({ footer: this.itemFoot.bind(this), scroller: this.scroller }) {
+ LazyForEach(this.datasource, (item: number) => {
+ FlowItem() {
+ Column() {
+ Text("N" + item).fontSize(12).height('16')
+ Image('res/waterFlowTest(' + item % 5 + ').jpg')
+ .objectFit(ImageFit.Fill)
+ }
+ }
+ .width(this.itemWidthArray[item])
+ .height(this.itemHeightArray[item])
+ .backgroundColor(this.colors[item % 5])
+ }, item => item)
+ }
+ .columnsTemplate("1fr 1fr 1fr 1fr")
+ .itemConstraintSize({
+ minWidth: 0,
+ maxWidth: '100%',
+ minHeight: 0,
+ maxHeight: '100%'
+ })
+ .columnsGap(10)
+ .rowsGap(5)
+ .onReachStart(() => {
+ console.info("onReachStart")
+ })
+ .onReachEnd(() => {
+ console.info("onReachEnd")
+ })
+ .backgroundColor(0xFAEEE0)
+ .width('100%')
+ .height('80%')
+ .layoutDirection(FlexDirection.Column)
+ }
+ }
+}
+```
+
+
diff --git a/en/application-dev/reference/arkui-ts/ts-media-components-video.md b/en/application-dev/reference/arkui-ts/ts-media-components-video.md
index 0c143bd234578db616fb7a86fccca80cb592b983..e5cedbf9e226c3b37ce9c0a525c70376075f6187 100644
--- a/en/application-dev/reference/arkui-ts/ts-media-components-video.md
+++ b/en/application-dev/reference/arkui-ts/ts-media-components-video.md
@@ -22,12 +22,12 @@ Video(value: {src?: string | Resource, currentProgressRate?: number | string | P
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------------------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| src | string \| [Resource](ts-types.md) | No | Path of the video source, which can be a local path or a URL. The video resources can be stored in the **video** or **rawfile** folder under **resources**. The path can include a **dataability://** prefix, which indicates that the path is provided by a Data ability. For details about the path, see [Data Ability Development](../../application-models/dataability-overview.md). **NOTE** The supported video formats are MP4, MKV, WebM, and TS. |
-| currentProgressRate | number \| string \| PlaybackSpeed8+ | No | Video playback speed. **NOTE** The value of the number type can only be **0.75**, **1.0**, **1.25**, **1.75**, or **2.0**. Default value: **1.0** \| **PlaybackSpeed.Speed_Forward_1_00_X** |
-| previewUri | string \| PixelMap8+ \| [Resource](ts-types.md) | No | Path of the preview image. |
-| controller | [VideoController](#videocontroller) | No | Video controller. |
+| Name | Type | Mandatory| Description |
+| ------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| src | string \| [Resource](ts-types.md) | No | Path of the video source, which can be a local path or a URL. The video resources can be stored in the **video** or **rawfile** folder under **resources**. The path can include a **dataability://** prefix, which indicates that the path is provided by a Data ability. For details about the path, see [Data Ability Development](../../application-models/dataability-overview.md). **NOTE** The supported video formats are MP4, MKV, WebM, and TS.|
+| currentProgressRate | number \| string \| PlaybackSpeed8+ | No | Video playback speed. **NOTE** The value of the number type can only be **0.75**, **1.0**, **1.25**, **1.75**, or **2.0**. Default value: 1.0 \| PlaybackSpeed.Speed_Forward_1_00_X |
+| previewUri | string \|PixelMap \| [Resource](ts-types.md) | No | Path of the preview image. (The PixelMap type is not supported currently.) |
+| controller | [VideoController](#videocontroller) | No | Video controller. |
## PlaybackSpeed8+
@@ -55,16 +55,16 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
-| Name | Description |
-| ---------------------------------------- | ---------------------------------------- |
-| onStart(event:() => void) | Triggered when the video is played. |
-| onPause(event:() => void) | Triggered when the video playback is paused. |
-| onFinish(event:() => void) | Triggered when the video playback is finished. |
-| onError(event:() => void) | Triggered when the video playback fails. |
+| Name | Description |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+| onStart(event:() => void) | Triggered when the video is played. |
+| onPause(event:() => void) | Triggered when the video playback is paused. |
+| onFinish(event:() => void) | Triggered when the video playback is finished. |
+| onError(event:() => void) | Triggered when the video playback fails. |
| onPrepared(callback:(event?: { duration: number }) => void) | Triggered when video preparation is complete. The video duration (in seconds) is obtained from **duration**.|
-| onSeeking(callback:(event?: { time: number }) => void) | Triggered to report the time (in seconds) when the progress bar is being dragged. |
-| onSeeked(callback:(event?: { time: number }) => void) | Triggered to report the playback time (in seconds) when the user finishes dragging the progress bar. |
-| onUpdate(callback:(event?: { time: number }) => void) | Triggered once per 250 ms when the playback progress changes. The unit of the current playback time is second. |
+| onSeeking(callback:(event?: { time: number }) => void) | Triggered to report the time (in seconds) when the progress bar is being dragged. |
+| onSeeked(callback:(event?: { time: number }) => void) | Triggered to report the playback time (in seconds) when the user finishes dragging the progress bar. |
+| onUpdate(callback:(event?: { time: number }) => void) | Triggered when the playback progress changes. The unit of the playback time is second. |
| onFullscreenChange(callback:(event?: { fullscreen: boolean }) => void) | Triggered when the playback mode is switched between full-screen mode and non-full-screen mode. The value **true** means that the playback is in full-screen mode, and **false** means that the playback is non-full-screen mode.|
diff --git a/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md b/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md
index cdf79922c3d5a05a663dc59d9f7fadb1eca515b9..4b326869620b8db4032f7e37345da899c2d52bf7 100644
--- a/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md
+++ b/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md
@@ -11,20 +11,20 @@ A custom dialog box is a dialog box you customize by using APIs of the **CustomD
## APIs
-CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean, alignment?: DialogAlignment, offset?: Offset, customStyle?: boolean, gridCount?: number, maskColor?: ResourceColor, openAnimation?: AnimateParam, closeAniamtion?: AnimateParam})
+CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean, alignment?: DialogAlignment, offset?: Offset, customStyle?: boolean, gridCount?: number, maskColor?: ResourceColor, openAnimation?: AnimateParam, closeAniamtion?: AnimateParam, showInSubWindow?: boolean})
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---------------------- | ---------------------------------------- | ------------------------- | ---------------------- |
-| builder | [CustomDialog](../../quick-start/arkts-dynamic-ui-elememt-building.md#customdialog) | Yes | Constructor of the custom dialog box content. |
-| cancel | () => void | No | Callback invoked when the dialog box is closed after the overlay exits. |
-| autoCancel | boolean | No | Whether to allow users to click the overlay to exit. Default value: **true** |
-| alignment | [DialogAlignment](ts-methods-alert-dialog-box.md#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction. Default value: **DialogAlignment.Default** |
-| offset | [Offset](ts-types.md#offset) | No | Offset of the dialog box relative to the alignment position.|
-| customStyle | boolean | No | Whether to use a custom style for the dialog box. Default value: **false**, which means that the dialog box automatically adapts its width to the grid system and its height to the child components; the maximum height is 90% of the container height; the rounded corner is 24 vp. |
-| gridCount8+ | number | No | Number of [grid columns](../../ui/ui-ts-layout-grid-container-new.md) occupied by the dialog box. The default value is 4, and the maximum value is the maximum number of columns supported by the system. If this parameter is set to an invalid value, the default value is used.|
+| Name | Type | Mandatory | Description |
+| ----------------------------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| builder | CustomDialog | Yes | Constructor of the custom dialog box content. |
+| cancel | () => void | No | Callback invoked when the dialog box is closed after the overlay exits. |
+| autoCancel | boolean | No | Whether to allow users to click the overlay to exit. Default value: **true** |
+| alignment | [DialogAlignment](ts-methods-alert-dialog-box.md#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction. Default value: **DialogAlignment.Default**|
+| offset | [Offset](ts-types.md#offset) | No | Offset of the dialog box relative to the alignment position. |
+| customStyle | boolean | No | Whether to use a custom style for the dialog box. Default value: **false**, which means that the dialog box automatically adapts its width to the grid system and its height to the child components; the maximum height is 90% of the container height; the rounded corner is 24 vp.|
+| gridCount8+ | number | No | Number of [grid columns](../../ui/arkts-layout-development-grid-layout.md) occupied by the dialog box. The default value is 4, and the maximum value is the maximum number of columns supported by the system. If this parameter is set to an invalid value, the default value is used.|
## CustomDialogController
@@ -34,7 +34,7 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, aut
dialogController : CustomDialogController = new CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean})
```
> **NOTE**
->
+>
> **CustomDialogController** is valid only when it is a member variable of the **@CustomDialog** and **@Component** decorated struct and is defined in the **@Component** decorated struct. For details, see the following example.
### open()
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-focus.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-focus.md
index 363bb92058913192b1353e819c27eb74bc0cdb63..a41f5a3d6a02527531695897e673047045c75d28 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-focus.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-focus.md
@@ -11,10 +11,10 @@ Focus control attributes set whether a component is focusable, how it participat
| Name | Type| Description |
| -------------------- | -------- | ---------------------------------------- |
-| focusable | boolean | Whether the current component is focusable. **NOTE** Components that have default interaction logic, such as **\** and **\**, are focusable by default. Other components, such as **\** and **\**, are not focusable by default. Only focusable components can trigger a [focus event](ts-universal-focus-event.md). |
+| focusable | boolean | Whether the current component is focusable. **NOTE** Components that have default interaction logic, such as **\** and **\**, are focusable by default. Other components, such as **\** and **\**, are not focusable by default. Only focusable components can trigger a [focus event](ts-universal-focus-event.md).|
| tabIndex9+ | number | How the current component participates in sequential keyboard navigation. - **tabIndex** >= 0: The component is focusable in sequential keyboard navigation, with its order defined by the value. A component with a larger value gains focus later than one with a smaller value. If multiple components share the same **tabIndex** value, their focus order follows their position in the component tree. - **tabIndex** < 0 (usually **tabIndex** = -1): The component is focusable, but cannot be reached through sequential keyboard navigation. Default value: **0**|
| defaultFocus9+ | boolean | Whether to set the current component as the default focus of the page. This attribute takes effect only when the page is new and accessed for the first time. Default value: **false**|
-| groupDefaultFocus9+ | boolean | Whether to set the current component as the default focus of the parent container. This attribute takes effect only when the container is new and has focus for the first time. Default value: **false** **NOTE** This attribute must be used together with **tabIndex**. When **tabIndex** is set for a container and **groupDefaultFocus** is set for a component in the container, the focus is automatically shifted to that component when the container obtains the focus for the first time. |
+| groupDefaultFocus9+ | boolean | Whether to set the current component as the default focus of the parent container. This attribute takes effect only when the container is new and has focus for the first time. Default value: **false** **NOTE** This attribute must be used together with **tabIndex**. When **tabIndex** is set for a container and **groupDefaultFocus** is set for a component in the container, the focus is automatically shifted to that component when the container obtains the focus for the first time.|
| focusOnTouch9+ | boolean | Whether the current component is focusable on touch. Default value: **false** **NOTE** The component can obtain focus only when it is touchable or clickable.|
## focusControl9+
@@ -39,7 +39,7 @@ Requests the focus to move to the specified component. This API can be used in g
> **NOTE**
>
-> The following components support focus control: **\**, **\**, **\**, **\**, and **\**. Currently, the running effect of the focus event can be displayed only on a real device.
+> The following components support focus control: **\**, **\