diff --git a/en/application-dev/ability/ability-assistant-guidelines.md b/en/application-dev/ability/ability-assistant-guidelines.md index de9f35adbce1e77603fa1a15ba8db8512c0fc8c0..94cf4bd493cab791481631f40645ed35e25115f3 100644 --- a/en/application-dev/ability/ability-assistant-guidelines.md +++ b/en/application-dev/ability/ability-assistant-guidelines.md @@ -28,13 +28,13 @@ The ability assistant is pre-installed in the device environment. You can direct Starts an ability. - | Name | Description | - | --------- | ---------------------- | - | -h/--help | Help information. | + | Name | Description | + | --------- | -------------------------- | + | -h/--help | Help information. | | -d | Device ID. This parameter is optional. | | -a | Ability name. This parameter is mandatory.| | -b | Bundle name. This parameter is mandatory. | - | -D | Debugging mode. This parameter is optional. | + | -D | Debugging mode. This parameter is optional. | **Return value** @@ -82,13 +82,20 @@ The ability assistant is pre-installed in the device environment. You can direct | -i/--ability | AbilityRecord ID | Prints detailed information about a specified ability. | | -c/--client | | Prints detailed ability information. This parameter must be used together with other parameters. Example commands: **aa dump -a -c** and **aa dump -i 21 -c**.| - **Method** - + ``` aa dump -a ``` - + ![aa-dump-a](figures/aa-dump-a.png) + ``` + aa dump -l + ``` + ![aa-dump-l](figures/aa-dump-l.png) + ``` + aa dump -i 12 + ``` +![aa-dump-i](figures/aa-dump-i.png) - **force-stop** Forcibly stops a process based on the bundle name. diff --git a/en/application-dev/ability/ability-delegator.md b/en/application-dev/ability/ability-delegator.md index a7766c11546d1a242e8e9531f4021907188a2ef8..cbf823bacad7b9781d90c8a86224893740444f35 100644 --- a/en/application-dev/ability/ability-delegator.md +++ b/en/application-dev/ability/ability-delegator.md @@ -10,7 +10,11 @@ The APIs provided by the test framework can be used only in the test HAP. They t ## Starting the Test Framework -The test framework can be started by running the **aa test** command or using the IDE. +The test framework can be started using either of the following methods: + +- Method 1: Run the **aa test** command. +- Method 2: Use the IDE. + ### Running aa test You can run the **aa test** command to start the test framework. You can specify the **TestRunner** to be used and the package name or module name of the HAP where the **TestRunner** is located. diff --git a/en/application-dev/ability/fa-brief.md b/en/application-dev/ability/fa-brief.md index baf58d144162435b5a7834c88440777ef84621a6..db7346a6f4723cdf5589a8e5671944d95ea3878f 100644 --- a/en/application-dev/ability/fa-brief.md +++ b/en/application-dev/ability/fa-brief.md @@ -1,19 +1,32 @@ # FA Model Overview ## Overall Architecture -The development of an OpenHarmony application is essentially the development of one or more abilities. By scheduling abilities and managing their lifecycle, OpenHarmony implements application scheduling. In the FA model, three types of abilities are provided: Page, Service, and Data. The Page ability has the ArkUI and therefore provides the capability of interacting with users. The Service ability does not have a UI. It runs in the background and provides custom services for other abilities to invoke. The Data ability does not have a UI. It also runs in the background and enables other abilities to insert, delete, and query data. +The development of an OpenHarmony application is essentially the development of one or more abilities. By scheduling abilities and managing their lifecycle, OpenHarmony implements application scheduling. + +The Feature Ability (FA) model applies to application development using API 8 and earlier versions. In this model, there are Page, Service, Data, and Form abilities. +- The Page ability implements the ArkUI and provides the capability of interacting with users. +- The Service ability does not have a UI. It runs in the background and provides custom services for other abilities to invoke. +- The Data ability does not have a UI. It also runs in the background and enables other abilities to insert, delete, and query data. +- The Form ability provides a widget, which is a UI display mode. ## Application Package Structure **The following figure shows the application package structure.** + ![fa-package-info](figures/fa-package-info.png) +For details about the application package structure, see [Description of the Application Package Structure Configuration File](../quick-start/package-structure.md). + ## Lifecycle +Among all abilities, the Page ability has the most complex lifecycle, because it has a UI and is the interaction entry of applications. **The following figure shows the lifecycle of the Page ability.** ![fa-pageAbility-lifecycle](figures/fa-pageAbility-lifecycle.png) -You can override lifecycle functions in **app.js/app.ets** to process application logic. +The other abilities do not involve the foreground/background switchover and the **onShow** callback. +You can override the lifecycle callbacks in **app.js/app.ets** to process application logic. + +Currently, the **app.js** file provides only the **onCreate** and **onDestroy** callbacks, and the **app.ets** file provides the full lifecycle callbacks. ## Process and Thread Model diff --git a/en/application-dev/ability/fa-pageability.md b/en/application-dev/ability/fa-pageability.md index b124d25c83f7f263b3f31318b85cde04fa2b597d..024c3397450b40858f31dfeef5ca3fe66dc2435e 100644 --- a/en/application-dev/ability/fa-pageability.md +++ b/en/application-dev/ability/fa-pageability.md @@ -2,28 +2,30 @@ ## Overview ### Concepts -The Page ability implements the ArkUI and provides the capability of interacting with users. When you create an ability in the integrated development environment (IDE), the IDE automatically creates template code. The capabilities related to the Page ability are exposed through the singleton **featureAbility**, and the lifecycle callbacks are exposed through the callbacks in **app.js/app.ets**. +The Page ability implements the ArkUI and provides the capability of interacting with users. When you create an ability in the integrated development environment (IDE), the IDE automatically creates template code. The capabilities related to the Page ability are implemented through the **featureAbility**, and the lifecycle callbacks are implemented through the callbacks in **app.js/app.ets**. ### Page Ability Lifecycle -**Ability Lifecycle** +**Ability lifecycle** -The ability lifecycle is a general term for all states of an ability, such as **INACTIVE**, **ACTIVE**, and **BACKGROUND**. The following figure shows the lifecycle state transition of the Page ability. +The Page ability lifecycle is a general term for all states of a Page ability, such as **INACTIVE**, **ACTIVE**, and **BACKGROUND**. + +The following figure shows the lifecycle state transition of the Page ability. ![PageAbility-Lifecycle](figures/page-ability-lifecycle.png) Description of ability lifecycle states: - - **UNINITIALIZED**: The ability is not initialized. This is a temporary state. An ability changes directly to the **INITIAL** state upon its creation. + - **UNINITIALIZED**: The Page ability is not initialized. This is a temporary state. A Page ability changes directly to the **INITIAL** state upon its creation. - - **INITIAL**: This state refers to the initial or stopped state. The ability in this state is not running. The ability enters the **INACTIVE** state after it is started. + - **INITIAL**: This state refers to the initial or stopped state. The Page ability in this state is not running. The Page ability enters the **INACTIVE** state after it is started. - **INACTIVE**: The ability is visible but does not gain focus. - **ACTIVE**: The ability runs in the foreground and gains focus. - - **BACKGROUND**: The ability returns to the background. After being re-activated, the ability enters the **ACTIVE** state. After being destroyed, the ability enters the **INITIAL** state. + - **BACKGROUND**: The Page ability returns to the background. After being re-activated, the Page ability enters the **ACTIVE** state. After being destroyed, the Page ability enters the **INITIAL** state. **The following figure shows the relationship between lifecycle callbacks and lifecycle states of the Page ability.** @@ -100,6 +102,7 @@ You can override the lifecycle callbacks provided by the Page ability in the **a ``` You can also include **parameters** in the **want** parameter and set its value in the key-value format. + **Example** ```javascript @@ -148,6 +151,7 @@ You can also include **parameters** in the **want** parameter and set its value ``` Obtain **deviceId** from **DeviceManager**. The sample code is as follows: + ```ts import deviceManager from '@ohos.distributedHardware.deviceManager'; let dmClass; @@ -167,6 +171,7 @@ Obtain **deviceId** from **DeviceManager**. The sample code is as follows: ``` In the cross-device scenario, the application must also apply for the data synchronization permission from end users. The sample code is as follows: + ```ts import abilityAccessCtrl from "@ohos.abilityAccessCtrl"; import bundle from '@ohos.bundle'; @@ -204,6 +209,7 @@ In the cross-device scenario, the application must also apply for the data synch ``` ### Lifecycle APIs + **Table 2** Lifecycle callbacks | API | Description | @@ -216,6 +222,7 @@ In the cross-device scenario, the application must also apply for the data synch | onActive() | Called when the ability is switched to the foreground and gains focus. | **Example** + You need to override the lifecycle callbacks in **app.js/app.ets**. The IDE template generates **onCreate()** and **onDestroy()** by default. You need to override the other callbacks. ```javascript diff --git a/en/application-dev/ability/figures/aa-dump-a.PNG b/en/application-dev/ability/figures/aa-dump-a.PNG new file mode 100644 index 0000000000000000000000000000000000000000..ae8d41f65f68d73895be5bbbb539c0d220b2a9a5 Binary files /dev/null and b/en/application-dev/ability/figures/aa-dump-a.PNG differ diff --git a/en/application-dev/ability/figures/aa-dump-i.PNG b/en/application-dev/ability/figures/aa-dump-i.PNG new file mode 100644 index 0000000000000000000000000000000000000000..12998c5ba3e7d667d1147b6e825f8d110d5c5c5e Binary files /dev/null and b/en/application-dev/ability/figures/aa-dump-i.PNG differ diff --git a/en/application-dev/ability/figures/aa-dump-l.PNG b/en/application-dev/ability/figures/aa-dump-l.PNG new file mode 100644 index 0000000000000000000000000000000000000000..a6797eef284990e3fa25e71562ac8afbddf0821d Binary files /dev/null and b/en/application-dev/ability/figures/aa-dump-l.PNG differ diff --git a/en/application-dev/ability/figures/fa-package-info.png b/en/application-dev/ability/figures/fa-package-info.png index 20f01625eed79a95962fdc0d8105e62c29d9dbb0..86da707408da8fdb149ea62d92298fed605132ca 100644 Binary files a/en/application-dev/ability/figures/fa-package-info.png and b/en/application-dev/ability/figures/fa-package-info.png differ diff --git a/en/application-dev/ability/figures/fa-pageAbility-lifecycle.png b/en/application-dev/ability/figures/fa-pageAbility-lifecycle.png index 3093a7765a9055a28527edd4280c4f476adf6d33..ab6e01af0cf96f852c37696fe0c23425219eca39 100644 Binary files a/en/application-dev/ability/figures/fa-pageAbility-lifecycle.png and b/en/application-dev/ability/figures/fa-pageAbility-lifecycle.png differ