• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# FA Model Overview
2
3## Overall Architecture
4
5Ability is the entry for application development in OpenHarmony.
6
7The core of ability development is the processing on ability lifecycle callbacks.
8
9The Feature Ability (FA) model can be used only for application development using API version 8 and earlier versions. In this model, there are PageAbility, ServiceAbility, DataAbility, and FormAbility.
10- PageAbility implements the ArkUI and provides the capability for interacting with users.
11- ServiceAbility does not have a UI. It runs in the background and provides custom services for other abilities to invoke.
12- DataAbility does not have a UI. It runs in the background and enables other abilities to insert, delete, and query data.
13- FormAbility is used to implement widgets, a new UI display form available on OpenHarmony devices.
14
15> Note: Starting from API version 9, the stage model is recommended for application development.
16
17## Lifecycle
18
19Among all abilities, PageAbility has the most complex lifecycle, because it has a UI and acts as a touchpoint for interacting with users.
20**The following figure shows the lifecycle of PageAbility.**
21
22![fa-pageAbility-lifecycle](figures/fa-pageAbility-lifecycle.png)
23
24The other abilities do not involve foreground and background switch or the **onShow** and **onHide** callbacks.
25You can override the lifecycle callbacks in **app.js** or **app.ets** to process application logic.
26
27The **app.js** file provides only the **onCreate** and **onDestroy** callbacks, and the **app.ets** file provides the callbacks covering the entire lifecycle.
28
29## Process and Thread Model
30
31Each application runs in a process. In the FA model, each ability runs in an independent VM.
32
33When an ability is started, an application process as well as a thread for this ability is created. For an application that has multiple abilities, each ability runs in an independent thread. In the FA model, each ability is bound to an independent VM instance. In this way, abilities are isolated from each other.
34
35![fa-threading-model](figures/fa-threading-model.png)
36
37## Application Package Structure
38
39For details about the project directory structure of the FA model, see [OpenHarmony Project Overview](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-project-overview-0000001218440650#section4154183910141).
40
41For details about how to configure the application package structure of the FA model, see [Application Package Structure Configuration File](../quick-start/application-configuration-file-overview-fa.md).
42
43
44