提交 0bd16c61 编写于 作者: W wangzhen 提交者: NEEN

!96 update application fwk readme

* Description: update application fwk readme
上级 2b3da847
...@@ -7,9 +7,9 @@ The application framework of OpenHarmony consists of two modules: **ability man ...@@ -7,9 +7,9 @@ The application framework of OpenHarmony consists of two modules: **ability man
**1. Ability management framework**: This framework is provided by OpenHarmony for you to develop OpenHarmony applications. The following figure shows the modules in the ability management framework. **1. Ability management framework**: This framework is provided by OpenHarmony for you to develop OpenHarmony applications. The following figure shows the modules in the ability management framework.
**Figure 1** Architecture of the Ability management framework<a name="fig18932193213292"></a> **Figure 1** Architecture of the Ability management framework<a name="fig18932193213292"></a>
![](figures/architecture-of-the-ability-management-framework.png "architecture-of-the-ability-management-framework") ![](figures/en-us_image_0000001054941316.png)
- **AbilityKit** is a development kit provided by the ability management framework. You can use this kit to develop applications based on the **Ability** component. There are two types of applications developed based on the **Ability** component: **JS Ability** developed using the JavaScript language and **Native Ability** developed using the C/C++ language. The **ACE** framework encapsulates JavaScript UI components on the basis of the AbilityKit and is used to help you quickly develop JS Ability-based applications. - **AbilityKit** is a development kit provided by the ability management framework. You can use this kit to develop applications based on the **Ability** component. There are two types of applications developed based on the **Ability** component: **JS Ability** developed using the JavaScript language and **Native Ability** developed using the C/C++ language. The **JS application development framework** encapsulates JavaScript UI components on the basis of the AbilityKit and is used to help you quickly develop JS Ability-based applications.
- **Ability** is the minimum unit for the system to schedule applications. It is a component that can implement an independent functionality. An application can contain one or more **Ability** instances. There are two types of templates that you can use to create an **Ability** instance: Page and Service. - **Ability** is the minimum unit for the system to schedule applications. It is a component that can implement an independent functionality. An application can contain one or more **Ability** instances. There are two types of templates that you can use to create an **Ability** instance: Page and Service.
- An **Ability using the Page template** \(Page ability for short\) provides a UI for interacting with users. - An **Ability using the Page template** \(Page ability for short\) provides a UI for interacting with users.
- An **Ability using the Service template** does not have a UI and is used for running background tasks. - An **Ability using the Service template** does not have a UI and is used for running background tasks.
...@@ -80,7 +80,7 @@ The following table describes the source code directory structure of the applica ...@@ -80,7 +80,7 @@ The following table describes the source code directory structure of the applica
</thead> </thead>
<tbody><tr id="row17977171010144"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p2793159171311"><a name="p2793159171311"></a><a name="p2793159171311"></a>foundation/aafwk/frameworks/ability_lite</p> <tbody><tr id="row17977171010144"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p2793159171311"><a name="p2793159171311"></a><a name="p2793159171311"></a>foundation/aafwk/frameworks/ability_lite</p>
</td> </td>
<td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p879375920132"><a name="p879375920132"></a><a name="p879375920132"></a>Core code of the ability management framework</p> <td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p879375920132"><a name="p879375920132"></a><a name="p879375920132"></a>Core code for AbilityKit</p>
</td> </td>
</tr> </tr>
<tr id="row6978161091412"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p0780163617556"><a name="p0780163617556"></a><a name="p0780163617556"></a>foundation/aafwk/frameworks/abilitymgr_lite</p> <tr id="row6978161091412"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p0780163617556"><a name="p0780163617556"></a><a name="p0780163617556"></a>foundation/aafwk/frameworks/abilitymgr_lite</p>
...@@ -95,12 +95,12 @@ The following table describes the source code directory structure of the applica ...@@ -95,12 +95,12 @@ The following table describes the source code directory structure of the applica
</tr> </tr>
<tr id="row1897841071415"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p20749155715720"><a name="p20749155715720"></a><a name="p20749155715720"></a>foundation/aafwk/interfaces/kits/abilitykit_lite</p> <tr id="row1897841071415"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p20749155715720"><a name="p20749155715720"></a><a name="p20749155715720"></a>foundation/aafwk/interfaces/kits/abilitykit_lite</p>
</td> </td>
<td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p14793959161317"><a name="p14793959161317"></a><a name="p14793959161317"></a>External APIs of the ability management framework</p> <td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p14793959161317"><a name="p14793959161317"></a><a name="p14793959161317"></a>APIs provided by AbilityKit for developers</p>
</td> </td>
</tr> </tr>
<tr id="row965423512587"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p12654103516589"><a name="p12654103516589"></a><a name="p12654103516589"></a>foundation/aafwk/interfaces/innerkits/abilitymgr_lite</p> <tr id="row965423512587"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p12654103516589"><a name="p12654103516589"></a><a name="p12654103516589"></a>foundation/aafwk/interfaces/innerkits/abilitymgr_lite</p>
</td> </td>
<td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p12658142611466"><a name="p12658142611466"></a><a name="p12658142611466"></a>APIs provided by the Ability Manager Service to other subsystems</p> <td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p12658142611466"><a name="p12658142611466"></a><a name="p12658142611466"></a>APIs provided by the Ability Manager Service for other subsystems</p>
</td> </td>
</tr> </tr>
<tr id="row673463115813"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p127343312581"><a name="p127343312581"></a><a name="p127343312581"></a>foundation/aafwk/interfaces/kits/want_lite</p> <tr id="row673463115813"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p127343312581"><a name="p127343312581"></a><a name="p127343312581"></a>foundation/aafwk/interfaces/kits/want_lite</p>
...@@ -115,12 +115,12 @@ The following table describes the source code directory structure of the applica ...@@ -115,12 +115,12 @@ The following table describes the source code directory structure of the applica
</tr> </tr>
<tr id="row1869744111581"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p10698114117583"><a name="p10698114117583"></a><a name="p10698114117583"></a>foundation/appexecfwk/interfaces/kits/bundle_lite</p> <tr id="row1869744111581"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p10698114117583"><a name="p10698114117583"></a><a name="p10698114117583"></a>foundation/appexecfwk/interfaces/kits/bundle_lite</p>
</td> </td>
<td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p1169814112585"><a name="p1169814112585"></a><a name="p1169814112585"></a>External bundle management APIs provided by the bundle management framework</p> <td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p1169814112585"><a name="p1169814112585"></a><a name="p1169814112585"></a>APIs provided by BundleKit for developers</p>
</td> </td>
</tr> </tr>
<tr id="row106931420217"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p86931748213"><a name="p86931748213"></a><a name="p86931748213"></a>foundation/appexecfwk/interfaces/innerkits/bundlemgr_lite</p> <tr id="row106931420217"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p86931748213"><a name="p86931748213"></a><a name="p86931748213"></a>foundation/appexecfwk/interfaces/innerkits/bundlemgr_lite</p>
</td> </td>
<td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p12693148215"><a name="p12693148215"></a><a name="p12693148215"></a>APIs provided by the Bundle Manager Service to other subsystems</p> <td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p12693148215"><a name="p12693148215"></a><a name="p12693148215"></a>Core code for AbilityKit and APIs provided by the Bundle Manager Service for other subsystems</p>
</td> </td>
</tr> </tr>
<tr id="row58381913213"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p11839171152117"><a name="p11839171152117"></a><a name="p11839171152117"></a>foundation/appexecfwk/frameworks/bundle_lite</p> <tr id="row58381913213"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p11839171152117"><a name="p11839171152117"></a><a name="p11839171152117"></a>foundation/appexecfwk/frameworks/bundle_lite</p>
...@@ -147,13 +147,13 @@ The following table describes the source code directory structure of the applica ...@@ -147,13 +147,13 @@ The following table describes the source code directory structure of the applica
- C++11 or later - C++11 or later
- The specifications of the application framework vary depending on the System-on-a-Chip \(SoC\) and underlying OS capabilities. - The specifications of the application framework vary depending on the System-on-a-Chip \(SoC\) and underlying OS capabilities.
- Cortex-M RAM and ROM: - Cortex-M RAM and ROM
- RAM: greater than 20 KB \(recommended\) - RAM: greater than 20 KB \(recommended\)
- ROM: greater than 300 KB \(for the ACE framework and related subsystems, such as UIKit and engine\) - ROM: greater than 300 KB \(for the JS application development framework and related subsystems, such as UIKit and engine\)
- Cortex-A RAM and ROM - Cortex-A RAM and ROM
- RAM: greater than 2 MB \(recommended\) - RAM: greater than 2 MB \(recommended\)
- ROM: greater than 2 MB \(for the ACE framework and related subsystems, such as UIKit and engine\) - ROM: greater than 2 MB \(for the JS application development framework and related subsystems, such as UIKit and engine\)
...@@ -231,7 +231,7 @@ The following table describes the source code directory structure of the applica ...@@ -231,7 +231,7 @@ The following table describes the source code directory structure of the applica
- After the preceding configurations are complete, run the following command to compile the entire system: - After the preceding configurations are complete, run the following command to compile the entire system:
``` ```
python build.py ipcamera -p hi3516dv300_liteos_a -b debug python build.py ipcamera_hi3516dv300 -b debug
``` ```
## Running the Two Services in the Application Framework<a name="section1048719468503"></a> ## Running the Two Services in the Application Framework<a name="section1048719468503"></a>
...@@ -253,78 +253,93 @@ deps = [ ...@@ -253,78 +253,93 @@ deps = [
## Running an Ability Developed Based on AbilityKit<a name="section16249444135119"></a> ## Running an Ability Developed Based on AbilityKit<a name="section16249444135119"></a>
- The demo code of the ability developed based on AbilityKit is stored in the **foundation/aafwk/frameworks/kits/ability\_lite/test** directory. If you need to modify the functionality, modify the code in the **unittest** file or add a code file, and update the configuration in **BUILD.gn** accordingly. - The demo code of the ability developed based on AbilityKit is stored in the **foundation/aafwk/frameworks/ability\_lite/example** directory. If you need to modify the functionality, modify the code in the **entry/src/main/cpp** files or add a new code file, and update the configuration in **BUILD.gn** accordingly.
- Run the following command in the shell to compile the demo. After the compilation is successful, the **libLauncher.so** file is generated in **out/ipcamera\_hi3516dv300\_liteos\_a**. - Add the configuration for the ability demo for compilation in the **build/lite/config/subsystem/aafwk/BUILD.gn** file.
``` ```
python build.py ipcamera -p hi3516dv300_liteos_a -T //foundation/aafwk/frameworks/kits/ability_lite/test:Launcher import("//build/lite/config/subsystem/lite_subsystem.gni")
lite_subsystem("aafwk") {
subsystem_components = [
"......",
"//foundation/aafwk/frameworks/ability_lite/example:hiability",
"......",
]
}
``` ```
- Modify the **config.json** file. The example content is as follows: - Run the following command in the shell to compile the demo. After the compilation is successful, the **libhiability.so** file is generated in **out/ipcamera\_hi3516dv300\_liteos\_a/dev\_tools/example**.
``` ```
{ python build.py ipcamera_hi3516dv300 -b debug
"app": { ```
"bundleName": "com.huawei.launcher",
"vendor": "huawei", - Compile the **config.json** file. For details, see the **config.json** file in the **foundation/aafwk/frameworks/ability\_lite/example** directory. The file content is as follows:
"version": {
"code": 1, ```
"name": "1.0" {
}, "app": {
"apiVersion": { "bundleName": "com.huawei.hiability",
"compatible": 3, "vendor": "huawei",
"target": 3 "version": {
} "code": 1,
}, "name": "1.0"
"deviceConfig": { },
"default": { "apiVersion": {
"keepAlive": false "compatible": 3,
}, "target": 3
}, }
"module": {
"deviceType": [
"smartVision"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "Launcher",
"moduleType": "entry"
},
"abilities": [{
"name": "MainAbility",
"icon": "assets/entry/resources/base/media/icon.png",
"label": "test app 1",
"launchType": "standard",
"type": "page",
"visible": true
}, },
{ "deviceConfig": {
"name": "SecondAbility", "default": {
"icon": "assets/entry/resources/base/media/icon.png", "keepAlive": false
"label": "test app 2", },
"launchType": "standard",
"type": "page",
"visible": true
}, },
{ "module": {
"name": "ServiceAbility", "deviceType": [
"icon": "", "smartVision"
"label": "test app 2", ],
"launchType": "standard", "distro": {
"type": "service", "deliveryWithInstall": true,
"visible": true "moduleName": "hiability",
"moduleType": "entry"
},
"abilities": [{
"name": "MainAbility",
"icon": "assets/entry/resources/base/media/icon.png",
"label": "test app 1",
"launchType": "standard",
"type": "page",
"visible": true
},
{
"name": "SecondAbility",
"icon": "",
"label": "test app 2",
"launchType": "standard",
"type": "page",
"visible": true
},
{
"name": "ServiceAbility",
"icon": "",
"label": "test app 2",
"launchType": "standard",
"type": "service",
"visible": true
}
]
} }
]
} }
} ```
```
- Generate a HAP. - Generate a HAP.
- Add resource files to the **assets/entry/resources/base/media** directory based on the following directory structure. - Add resource files to the **assets/entry/resources/base/media** directory based on the following directory structure.
![](figures/en-us_image_0000001055712348.png) ![](figures/en-us_image_0000001055267336.png)
- Compress the preceding files into a ZIP package and change the file name extension to **.hap**, for example, **Launcher.hap**. - Compress the preceding files into a ZIP package and change the file name extension to **.hap**, for example, **hiability.hap**.
- Install the HAP. - Install the HAP.
...@@ -332,13 +347,13 @@ deps = [ ...@@ -332,13 +347,13 @@ deps = [
- Run the following command to install the HAP: - Run the following command to install the HAP:
``` ```
./bin/bm install -p /nfs/hap/Launcher.hap ./bin/bm install -p /nfs/hap/hiability.hap
``` ```
- After the installation is complete, run the following command to run the demo: - After the installation is complete, run the following command to run the demo:
``` ```
./bin/aa start -p com.huawei.launcher -n MainAbility ./bin/aa start -p com.huawei.hiability -n MainAbility
``` ```
## Repositories Involved<a name="section93061357133720"></a> ## Repositories Involved<a name="section93061357133720"></a>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
- **AbilityKit**是Ability框架提供给开发者的开发包,开发者基于该开发包可以开发出基于Ability组件的应用。基于Ability组件开发的应用有两种类型:基于Javascript语言开发的Ability(**JS Ability**)和基于C/C++语言开发的Ability(**Native Ability**)。**JS应用开发框架**是开发者开发JS Ability所用到框架,是在AbilityKit基础封装的包含js UI组件的一套方便开发者能够迅速开发Ability应用的框架。 - **AbilityKit**是Ability框架提供给开发者的开发包,开发者基于该开发包可以开发出基于Ability组件的应用。基于Ability组件开发的应用有两种类型:基于Javascript语言开发的Ability(**JS Ability**)和基于C/C++语言开发的Ability(**Native Ability**)。**JS应用开发框架**是开发者开发JS Ability所用到框架,是在AbilityKit基础封装的包含js UI组件的一套方便开发者能够迅速开发Ability应用的框架。
- **Ability**是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。Ability分为两种类型:Page类型的Ability和Service类型的Ability - **Ability**是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。Ability分为两种类型:Page类型的Ability和Service类型的Ability
- **Page类型的Ability**带有界面,为用户提供人机交互的能力。 - **Page类型的Ability:**带有界面,为用户提供人机交互的能力。
- **Service类型的Ability**:不带界面,为用户提供后台任务机制。 - **Service类型的Ability**:不带界面,为用户提供后台任务机制。
- **AbilitySlice**是单个页面及其控制逻辑的总和,是Page类型Ability特有的组件,一个Page类型的Ability可以包含多个AbilitySlice,此时,这些页面提供的业务能力应当是高度相关的。Page类型的Ability和AbilitySlice的关系如下图2所示: - **AbilitySlice**是单个页面及其控制逻辑的总和,是Page类型Ability特有的组件,一个Page类型的Ability可以包含多个AbilitySlice,此时,这些页面提供的业务能力应当是高度相关的。Page类型的Ability和AbilitySlice的关系如下图2所示:
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
- **UNINITIALIZED**:未初始状态,为临时状态,Ability被创建后会由UNINITIALIZED状态进入INITIAL状态; - **UNINITIALIZED**:未初始状态,为临时状态,Ability被创建后会由UNINITIALIZED状态进入INITIAL状态;
- **INITIAL**:初始化状态,也表示停止状态,表示当前Ability未运行,调用Start后进入INACTIVE,同时回调开发者的OnSatrt生命周期回调; - **INITIAL**:初始化状态,也表示停止状态,表示当前Ability未运行,调用Start后进入INACTIVE,同时回调开发者的OnStart生命周期回调;
- **INACTIVE**:未激活状态,表示当前窗口已显示但是无焦点状态,由于Window暂未支持焦点的概念,当前状态与ACTIVE一致。 - **INACTIVE**:未激活状态,表示当前窗口已显示但是无焦点状态,由于Window暂未支持焦点的概念,当前状态与ACTIVE一致。
...@@ -42,16 +42,16 @@ ...@@ -42,16 +42,16 @@
- **AbilityLoader**负责注册和加载开发者Ability的模块。开发者开发的Ability先要调用AbilityLoader的注册接口注册到框架中,接着Ability启动时会被实例化。 - **AbilityLoader**负责注册和加载开发者Ability的模块。开发者开发的Ability先要调用AbilityLoader的注册接口注册到框架中,接着Ability启动时会被实例化。
- **AbilityManager**负责AbilityKit和Ability管理服务进行IPC的通信。 - **AbilityManager**负责AbilityKit和Ability管理服务进行IPC的通信。
- **EvenHandler**是AbilityKit提供给开发者的用于在Ability中实现线程间通信的一个模块。 - **EventHandler**是AbilityKit提供给开发者的用于在Ability中实现线程间通信的一个模块。
- **Ability运行管理服务**是用于协调各Ability运行关系、及生命周期进行调度的系统服务。其中,**服务启动**模块负责Ability管理服务的启动、注册等。**服务接口管理模块**负责Ability管理服务对外能力的管理。**进程管理模块**负责Ability应用所在进程的启动和销毁、及其进程信息维护等功能。**Ability栈管理模块**负责维护各个Ability之间跳转的先后关系。**生命周期调度模块**是Ability管理服务根据系统当前的操作调度Ability进入相应的状态的模块**。连接管理模块**是Ability管理服务对Service类型Ability连接管理的模块。 - **Ability运行管理服务**是用于协调各Ability运行关系、及生命周期进行调度的系统服务。其中,**服务启动**模块负责Ability管理服务的启动、注册等。**服务接口管理模块**负责Ability管理服务对外能力的管理。**进程管理模块**负责Ability应用所在进程的启动和销毁、及其进程信息维护等功能。**Ability栈管理模块**负责维护各个Ability之间跳转的先后关系。**生命周期调度模块**是Ability管理服务根据系统当前的操作调度Ability进入相应的状态的模块**。连接管理模块**是Ability管理服务对Service类型Ability连接管理的模块。
- **AppSpawn**是负责创建Ability应用所在进程的系统服务,该服务有较高的权限,为Ability应用设置相应的权限,并预加载一些通用的模块,加速应用的启动。 - **AppSpawn**是负责创建Ability应用所在进程的系统服务,该服务有较高的权限,为Ability应用设置相应的权限,并预加载一些通用的模块,加速应用的启动。
**2. 包管理子系统**,是HarmonyOS为开发者提供的安装包管理框架。包管理子系统的由如下图4模块组成: **2. 包管理子系统**,是OpenHarmony为开发者提供的安装包管理框架。包管理子系统的由如下图4模块组成:
**图 4** 包管理子系统框架图<a name="fig1047932418305"></a> **图 4** 包管理子系统框架图<a name="fig1047932418305"></a>
![](figures/包管理子系统框架图.png "包管理子系统框架图") ![](figures/包管理子系统框架图.png "包管理子系统框架图")
- **BundleKit**是包管理服务对外提供的接口,有安装/卸载接口、包信息查询接口、包状态变化监听接口。 - **BundleKit:**是包管理服务对外提供的接口,有安装/卸载接口、包信息查询接口、包状态变化监听接口。
- **包扫描器**:用来解析本地预制或者安装的安装包,提取里面的各种信息,供管理子模块进行管理,持久化。 - **包扫描器**:用来解析本地预制或者安装的安装包,提取里面的各种信息,供管理子模块进行管理,持久化。
- **包安装子模块**:安装,卸载,升级一个包;**包安装服务**一个单独进程的用于创建删除安装目录,具有较高的权限。 - **包安装子模块**:安装,卸载,升级一个包;**包安装服务**一个单独进程的用于创建删除安装目录,具有较高的权限。
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
</tr> </tr>
<tr id="row106931420217"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p86931748213"><a name="p86931748213"></a><a name="p86931748213"></a>foundation/appexecfwk/interfaces/innerkits/bundlemgr_lite</p> <tr id="row106931420217"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p86931748213"><a name="p86931748213"></a><a name="p86931748213"></a>foundation/appexecfwk/interfaces/innerkits/bundlemgr_lite</p>
</td> </td>
<td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p12693148215"><a name="p12693148215"></a><a name="p12693148215"></a>AbilityKit实现的核心代码,及包管理服务为其它子系统提供的接口</p> <td class="cellrowborder" valign="top" width="63.82%" headers="mcps1.2.3.1.2 "><p id="p12693148215"><a name="p12693148215"></a><a name="p12693148215"></a>BundleKit实现的核心代码,及包管理服务为其它子系统提供的接口</p>
</td> </td>
</tr> </tr>
<tr id="row58381913213"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p11839171152117"><a name="p11839171152117"></a><a name="p11839171152117"></a>foundation/appexecfwk/frameworks/bundle_lite</p> <tr id="row58381913213"><td class="cellrowborder" valign="top" width="36.18%" headers="mcps1.2.3.1.1 "><p id="p11839171152117"><a name="p11839171152117"></a><a name="p11839171152117"></a>foundation/appexecfwk/frameworks/bundle_lite</p>
...@@ -226,12 +226,12 @@ ...@@ -226,12 +226,12 @@
- 添加完上述的配置后,执行如下命令编译整个系统: - 添加完上述的配置后,执行如下命令编译整个系统:
``` ```
python build.py ipcamera -p hi3516dv300_liteos_a -b debug python build.py ipcamera_hi3516dv300 -b debug
``` ```
## 运行用户程序框架子系统的两个服务<a name="section1048719468503"></a> ## 运行用户程序框架子系统的两个服务<a name="section1048719468503"></a>
- 用户程序框架有两个系统服务ability管理服务(abilityms)和(bundlems),两系统服务运行于foudation进程中。 - 用户程序框架有两个系统服务ability管理服务(abilityms)和(bundlems),两系统服务运行于foundation进程中。
- abilityms和bundlems注册到sa\_manager中,sa\_manager运行于foundation进程中,sa\_manager为abilityms和bundlems创建线程运行环境。具体创建abilityms、bundlems服务的方式以及使用该服务的方式,可参考[系统服务框架子系统](zh-cn_topic_0000001051589563.md) - abilityms和bundlems注册到sa\_manager中,sa\_manager运行于foundation进程中,sa\_manager为abilityms和bundlems创建线程运行环境。具体创建abilityms、bundlems服务的方式以及使用该服务的方式,可参考[系统服务框架子系统](zh-cn_topic_0000001051589563.md)
- 在foundation/distributedschedule/services/safwk\_lite/BUILD.gn中添加对abilityms和bundlems,如下: - 在foundation/distributedschedule/services/safwk\_lite/BUILD.gn中添加对abilityms和bundlems,如下:
...@@ -248,78 +248,93 @@ deps = [ ...@@ -248,78 +248,93 @@ deps = [
## 运行基于AbilityKit开发的Ability<a name="section16249444135119"></a> ## 运行基于AbilityKit开发的Ability<a name="section16249444135119"></a>
- 基于AbilityKit开发的Ability的Demo代码位于foundation/aafwk/frameworks/kits/ability\_lite/test路径下,如有需要修改其中的功能,可在unittest的文件中修改代码或增加代码文件,并在BUILD.gn中做相应的修改。 - 基于AbilityKit开发的Ability的Demo代码位于foundation/aafwk/frameworks/ability\_lite/example路径下,如有需要修改其中的功能,可在entry/src/main/cpp的文件中修改代码或增加代码文件,并在BUILD.gn中做相应的修改。
- 编译该Demo,在shell中执行如下命令,编译成功后,在out/ipcamera\_hi3516dv300\_liteos\_a下面生成libLauncher.so文件 - 在build/lite/config/subsystem/aafwk/BUILD.gn中添加对ability Demo编译配置
``` ```
python build.py ipcamera -p hi3516dv300_liteos_a -T //foundation/aafwk/frameworks/kits/ability_lite/test:Launcher import("//build/lite/config/subsystem/lite_subsystem.gni")
lite_subsystem("aafwk") {
subsystem_components = [
"......",
"//foundation/aafwk/frameworks/ability_lite/example:hiability",
"......",
]
}
``` ```
-写config.json,内容如下 -译该Demo,在shell中执行如下命令,编译成功后,在out/ipcamera\_hi3516dv300\_liteos\_a/dev\_tools/example下面生成libhiability.so文件
``` ```
{ python build.py ipcamera_hi3516dv300 -b debug
"app": { ```
"bundleName": "com.huawei.launcher",
"vendor": "huawei", - 编写config.json,参见foundation/aafwk/frameworks/ability\_lite/example路径下的config.josn,内容如下:
"version": {
"code": 1, ```
"name": "1.0" {
}, "app": {
"apiVersion": { "bundleName": "com.huawei.hiability",
"compatible": 3, "vendor": "huawei",
"target": 3 "version": {
} "code": 1,
}, "name": "1.0"
"deviceConfig": { },
"default": { "apiVersion": {
"keepAlive": false "compatible": 3,
}, "target": 3
}, }
"module": {
"deviceType": [
"smartVision"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "Launcher",
"moduleType": "entry"
},
"abilities": [{
"name": "MainAbility",
"icon": "assets/entry/resources/base/media/icon.png",
"label": "test app 1",
"launchType": "standard",
"type": "page",
"visible": true
}, },
{ "deviceConfig": {
"name": "SecondAbility", "default": {
"icon": "assets/entry/resources/base/media/icon.png", "keepAlive": false
"label": "test app 2", },
"launchType": "standard",
"type": "page",
"visible": true
}, },
{ "module": {
"name": "ServiceAbility", "deviceType": [
"icon": "", "smartVision"
"label": "test app 2", ],
"launchType": "standard", "distro": {
"type": "service", "deliveryWithInstall": true,
"visible": true "moduleName": "hiability",
"moduleType": "entry"
},
"abilities": [{
"name": "MainAbility",
"icon": "assets/entry/resources/base/media/icon.png",
"label": "test app 1",
"launchType": "standard",
"type": "page",
"visible": true
},
{
"name": "SecondAbility",
"icon": "",
"label": "test app 2",
"launchType": "standard",
"type": "page",
"visible": true
},
{
"name": "ServiceAbility",
"icon": "",
"label": "test app 2",
"launchType": "standard",
"type": "service",
"visible": true
}
]
} }
]
} }
} ```
```
- 生成hap包 - 生成hap包
- 按照如下目录结构存放文件,assets/entry/resources/base/media下面放置资源文件: - 按照如下目录结构存放文件,assets/entry/resources/base/media下面放置资源文件:
![](figures/zh-cn_image_0000001055712348.png) ![](figures/zh-cn_image_0000001055267336.png)
- 将上述文件打包生成zip包,修改后缀为.hap,例如Launcher.hap - 将上述文件打包生成zip包,修改后缀为.hap,例如hiability.hap
- 安装hap包 - 安装hap包
...@@ -327,13 +342,13 @@ deps = [ ...@@ -327,13 +342,13 @@ deps = [
- 执行安装命令,安装hap包: - 执行安装命令,安装hap包:
``` ```
./bin/bm install -p /nfs/hap/Launcher.hap ./bin/bm install -p /nfs/hap/hiability.hap
``` ```
- 安装完成后,通过如下命令,运行Demo - 安装完成后,通过如下命令,运行Demo
``` ```
./bin/aa start -p com.huawei.launcher -n MainAbility ./bin/aa start -p com.huawei.hiability -n MainAbility
``` ```
## 涉及仓<a name="section93061357133720"></a> ## 涉及仓<a name="section93061357133720"></a>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册