README.md
1# Bundle Management Framework<a name="EN-US_TOPIC_0000001061838370"></a>
2
3- [Introduction](#section11660541593)
4- [Directory Structure](#section1464106163817)
5- [Repositories Involved](#section93061357133720)
6
7## Introduction<a name="section11660541593"></a>
8
9The bundle management framework is provided by OpenHarmony for you to manage application bundles \(installation packages\). The following figure shows the architecture of the bundle management framework.
10
11**Figure 1** Bundle management framework architecture<a name="fig1047932418305"></a>
12![](figures/bundle-management-framework-architecture.png "bundle-management-framework-architecture")
13
14- **BundleKit** includes external APIs provided by the Bundle Manager Service, including the APIs for application installation and uninstallation, bundle information query, and bundle state change listeners.
15- The **bundle scanning sub-module** parses pre-installed or installed bundles on the local device and extracts information from them for the bundle management sub-module to manage and make the information persistent for storage.
16
17- The **bundle installation sub-module** installs, uninstalls, and updates a bundle.
18- The **bundle installation service** is an independent process used to create or delete installation directories and has high permissions.
19
20- The **bundle management sub-module** manages information related to application bundles and stores persistent bundle information.
21
22- The **bundle security management sub-module** verifies signatures, and grants and manages permissions.
23
24## Directory Structure<a name="section1464106163817"></a>
25
26```
27/foundation/bundlemanager/bundle_framework_lite
28 ├── frameworks
29 │ └── bundle_lite # Client code used for communication between the BundleKit and Bundle Manager Service
30 ├── interfaces
31 │ ├── kits
32 │ │ └── bundle_lite # BundleKit APIs exposed externally
33 │ └── inner_api
34 │ └── bundlemgr_lite # Core implementation code of BundleKit and internal APIs provided by the Bundle Manager Service for other subsystems
35 ├── services
36 │ └── bundlemgr_lite # Implementation code of the Bundle Manager Service
37 └── utils
38 └── bundle_lite # Utility code used during the implementation of the Bundle Manager Service
39```
40
41- The Bundle Manager Service is running in the foundation process.
42- The Bundle Manager Service is registered with **sa\_manager**. **sa\_manager** runs in the foundation process and sets up a thread runtime environment for the service. For details about how to create and use the Bundle Manager Service, see [SA Framework](en-us_topic_0000001051589563.md).
43- The Bundle Manager Service starts upon OS startup.
44- You can use the bm tool to install the specified HAP. \(Taking **hispark\_taurus** as an example, you can obtain the bm tool from the **out/hispark\_taurus/ipcamera\_hispark\_taurus/dev\_tools/bin directory** after the version building.\)
45
46```
47./bin/bm install -p /nfs/xxxx.hap
48```
49
50## Repositories Involved<a name="section93061357133720"></a>
51
52[ability\_ability\_lite](https://gitee.com/openharmony/ability_ability_lite/blob/master/README.md)
53
54**bundlemanager\_bundle\_framework\_lite**
55
56
README_zh.md
1# 包管理子系统<a name="ZH-CN_TOPIC_0000001061838370"></a>
2
3- [简介](#section11660541593)
4- [目录](#section1464106163817)
5- [编译构建/使用方法](#section1464106163819)
6- [使用说明](#section1464106163820)
7- [相关仓](#section93061357133720)
8
9## 简介<a name="section11660541593"></a>
10
11**包管理子系统**是OpenHarmony为开发者提供的应用安装包的管理框架,该模块实现的功能包括了应用的安装,卸载,升级,应用信息的查询和应用状态监听。当前仅支持在OpenHarmony的轻量级设备上运行,支持的设备包括穿戴手表,Hi3516DV300等。包管理子系统由如下模块组成:
12
13**图 1** 包管理子系统架构图<a name="fig1047932418305"></a>
14![](figures/包管理组件框架图.png "包管理组件框架图")
15
16- **BundleKit**:是包管理服务对外提供的接口,有安装/卸载接口、包信息查询接口、包状态变化监听接口。
17- **包扫描子模块**:用来解析本地预制或者安装的安装包,提取里面的各种信息,供管理子模块进行管理,持久化。
18
19- **包安装子模块**:负责安装,卸载,升级一个包。
20- **包安装服务**:一个单独进程的用于创建删除安装目录,具有较高的权限。
21
22- **包管理子模块**:管理安装包相关的信息,存储持久化包信息。
23
24- **包安全管理子模块**:签名检查、权限授予、权限管理。
25
26## 目录<a name="section1464106163817"></a>
27
28```
29/foundation/bundlemanager/bundle_framework_lite
30 ├── frameworks
31 │ └── bundle_lite # 管理BundleKit与包管理服务通信的客户端代码
32 ├── interfaces
33 │ ├── kits
34 │ │ └── bundle_lite # BundleKit为开发者提供的接口
35 │ └── inner_api
36 │ └── bundlemgr_lite # BundleKit实现的核心代码,及包管理服务为其它子系统提供的接口
37 ├── services
38 │ └── bundlemgr_lite # 包管理服务的实现代码
39 └── utils
40 └── bundle_lite # 包管理服务实现中用到的工具性的代码
41```
42
43## 编译构建/使用方法 <a name="section1464106163819"></a>
44
45- 当前OpenHarmony使用hb工具进行编译,需在代码的根目录下执行,编译的命令如下:
46```
47hb set # 选择需要烧录的设备类型
48hb build -f # 编译全量的代码
49hb build -T bundlems # 编译单个模块
50```
51- 使用bm工具可以安装指定的hap包(以hispark\_taurus为例,bm工具在系统构建后放置在out/hispark\_taurus/ipcamera\_hispark\_taurus/dev\_tools/bin下):
52
53```
54./bin/bm install -p /nfs/xxxx.hap # 安装xxxx.hap
55```
56- 使用bm工具查询应用的信息,具体执行命令如下:
57
58```
59./bin/bm dump -n 包名 # 查询对应包名的应用的包信息
60./bin/bm dump -l # 查询所有应用的包信息
61```
62
63## 使用说明 <a name="section1464106163820"></a>
64
65- 包管理服务为BundleMs,服务运行于foudation进程中;
66- 系统启动后,BundleMs会随系统启动而启动;
67- BundleMs注册到sa\_manager中,sa\_manager运行于foundation进程中,sa\_manager为BundleMs创建线程运行环境。具体创建BundleMs服务的方式以及使用该服务的方式,可参考系统服务框架子系统;
68
69
70## 相关仓<a name="section93061357133720"></a>
71
72[ability\_ability\_lite](https://gitee.com/openharmony/ability_ability_lite/blob/master/README_zh.md)
73
74**bundlemanager\_bundle\_framework\_lite**
75
76