• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# **Bundle Management**
2
3## Introduction
4
5The Bundle Management subsystem allows you to query, install, update, and uninstall capabilities for application bundles as well as store bundle information.
6
7Below is the architecture of the Bundle Management subsystem.
8
9![](figures/appexecfwk.png)
10
11
12## Responsibilities of Modules
13
14| Module      | Description                                                        |
15| ---------------- | ------------------------------------------------------------ |
16| Bundle management interface module  | 1. Provides external interfaces for installation, update, uninstallation, and notification.<br>2. Provides external interfaces for querying bundle, component, and permission information.<br>3. Provides external interfaces for querying application permissions.<br>4. Provides external interfaces for clearing data.|
17| Scanning module        | 1. Scans pre-installed applications.<br>2. Scans installed third-party applications.<br>3. Parses bundle configuration files.|
18| Security management module    | 1. Verifies signatures during installation.<br>2. Grants the permissions requested by the application during installation.<br>3. Verifies permissions during application running.|
19| DBMS module        | Obtains the ability information about a specified device.                                 |
20| Installation management module    | Provides installation, update, and uninstallation logic processing and result notification.                      |
21| Bundle information management module  | Stores and synchronizes bundle and component information.                            |
22| Device status listening module| Listens for the online and offline status changes of devices.                                        |
23| Installed module    | Provides privileged processes for:<br>(1) Creating and deleting directories<br>(2) Creating and deleting files<br>(3) Sandbox UID/GID operations in the device directory|
24| DFX              | Provides bundle maintenance and testing.                                              |
25
26
27## Directory Structure
28
29```
30foundation/bundlemanager/bundle_framework
31├── bundle_tool                        # bm code
32├── distributed_bundle_framework       # Framework code of the distributed bundle management service
33├── common
34│   └── log							   # Log component
35├── interfaces
36│   ├── inner_api                      # Internal APIs
37│   └── kits                           # Application APIs
38│       ├── js                         # JS APIs
39│       └── native                     # C/C++ APIs
40├── services                           # Framework code of the bundle management service
41├── test						       # Testing
42```
43
44
45### bm Commands
46bm is a tool used to facilitate debugging. It is encapsulated in the HDC tool. You can use it by running bm commands in the HDC shell.
47| Command   | Description      |
48| ------- | ---------- |
49|  help | Displays the commands supported by the bm tool.|
50| install | Installs an application.|
51| uninstall | Uninstalls an application.|
52| dump | Queries application information.|
53| clean | Clears the cache and data of an application.|
54| enable | Enables an application.|
55| disable | Disables an application.|
56| get | Obtains the UDID of a device.|
57#### Help Command
58| Command   | Description      |
59| ------- | ---------- |
60| bm help | Displays the commands supported by the bm tool.|
61
62* Example
63```Bash
64# Display help information.
65bm help
66```
67#### Installation Command
68This command can be run with different options to achieve different purposes. The table below lists some examples.
69| Command                               | Description                      |
70| ----------------------------------- | -------------------------- |
71| bm install -h | Displays the commands supported by **install**.|
72| bm install -p <hap-file-path>    | Installs HAPs. You can specify a path to install one or more HAPs at the same time.|
73| bm install -p <hap-file-path> -u <user-id>   |Installs a HAP for a specified user.|
74| bm install -r -p <hap-file-path> | Installs a HAP in overwrite mode.|
75| bm install -r -p <hap-file-path> -u <user-id> | Installs a HAP for a specified user in overwrite mode.|
76
77* Example
78```Bash
79# Install a HAP.
80bm install -p /data/app/ohosapp.hap
81# Install a HAP in overwrite mode.
82bm install -p /data/app/ohosapp.hap -r
83```
84#### Uninstallation Command
85This command can be run with different options to achieve different purposes. The table below lists some examples. If **-u** is not specified, the command applies to all users.
86| Command                         | Description                    |
87| ----------------------------- | ------------------------ |
88| bm uninstall -h | Displays the commands supported by **uninstall**.|
89| bm uninstall -n <bundle-name> | Uninstalls an application based on the specified bundle name.|
90| bm uninstall -n <bundle-name> -k | Uninstalls an application based on the specified bundle name, while retaining the data directory of the application.|
91| bm uninstall -n <bundle-name> -u <user-id>| Uninstalls an application based on the specified bundle name and user.|
92| bm uninstall -n <bundle-name> -m <moudle-name> | Uninstalls a specific module of an application based on the specified bundle name.|
93
94* Example
95```Bash
96# Uninstall a HAP.
97bm uninstall -n com.ohos.app
98# Uninstall a HAP while retaining its data directory.
99bm uninstall -n com.ohos.app -k
100# Uninstall an ability of the HAP.
101bm uninstall -n com.ohos.app -m com.ohos.app.MainAbility
102```
103#### Query Command
104This command can be run with different options to achieve different purposes. The table below lists some examples. If **-u** is not specified, the command applies to all users.
105| Command      | Description                      |
106| ---------- | -------------------------- |
107| bm dump -h | Displays the commands supported by **dump**.|
108| bm dump -a | Queries all applications installed in the system.|
109| bm dump -n <bundle-name> | Queries details about a specified bundle.|
110| bm dump -n <bundle-name> -s | Queries the shortcut information of a specified bundle.|
111| bm dump -n <bundle-name> -d <device-id> | Queries information about a bundle on a remote device.|
112| bm dump -n <bundle-name> -u <user-id> | Queries details about a specified bundle of a specified user.|
113
114* Example
115```Bash
116# Display the names of all applications installed in the system.
117bm dump -a
118# Display details about a specific application.
119bm dump -n com.ohos.app
120```
121#### Clean Command
122-If **-u** is not specified, the command applies to all active users.
123| Command      | Description                      |
124| ---------- | -------------------------- |
125| bm clean -h | Displays the commands supported by **clean**.|
126| bm clean -n <bundle-name> -c | Clears the cache data of the specified bundle.|
127| bm clean -n <bundle-name> -d | Clears the data directory of the specified bundle.|
128| bm clean -n <bundle-name> -c -u <user-id> | Clears the cached data of the specified bundle for the specified user.|
129| bm clean -n <bundle-name> -d -u <user-id> | Clears the data directory of the specified bundle for the specified user.|
130
131* Example
132```Bash
133# Clear the cache data of the specified bundle.
134bm clean -n com.ohos.app -c
135# Clear the user data of the specified bundle.
136bm clean -n com.ohos.app -d
137```
138#### Enable Command
139-If **-u** is not specified, the command applies to all active users.
140| Command      | Description                      |
141| ---------- | -------------------------- |
142| bm enable -h | Displays the commands supported by **enable**.|
143| bm enable -n <bundle-name> | Enables the application that matches the specified bundle name.|
144| bm enable -n <bundle-name> -a <ability-name> | Enables a specific ability module of the application that matches the specified bundle name.|
145| bm enable -n <bundle-name> -u <user-id>| Enables the application that matches the specified bundle name for the specified user.|
146
147* Example
148```Bash
149# Enable the specified application.
150bm enable -n com.ohos.app
151```
152#### Disable Command
153-If **-u** is not specified, the command applies to all active users.
154| Command      | Description                      |
155| ---------- | -------------------------- |
156| bm disable -h | Displays the commands supported by **disable**.|
157| bm disable -n <bundle-name> | Disables the application that matches the specified bundle name.|
158| bm disable -n <bundle-name> -a <ability-name> | Disables a specific ability module of the application that matches the specified bundle name.|
159| bm disable -n <bundle-name> -u <user-id>| Disables the application that matches the specified bundle name for the specified user.|
160
161* Example
162```Bash
163# Disable the specified application.
164bm disable -n com.ohos.app
165```
166#### Command for Obtaining the UDID
167| Command      | Description                      |
168| ---------- | -------------------------- |
169| bm get -h | Displays the commands supported by **get**.|
170| bm get -u | Obtains the UDID of a device.|
171
172* Example
173```Bash
174# Obtain the UDID of a device.
175bm get -u
176```
177
178## Repositories Involved
179
180Bundle Management Subsystem
181
182[**appexecfwk_standard**](https://gitee.com/openharmony/appexecfwk_standard)
183
184[developtools_packing_tool](https://gitee.com/openharmony/developtools_packing_tool)
185