• 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 Name      | 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/appexecfwk/standard
31├── kits
32│   └── appkit						   # Core code for Appkit implementation
33├── common
34│   └── log							   # Log component
35├── interfaces
36│   └── innerkits					   # Internal interfaces
37├── services
38│   └── bundlemgr	                   # Framework code of the bundle management service
39│   └── dbms	                       # Framework code of the distributed bundle management service
40├── test						       # Testing
41└── tools                              # bm commands
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> -u <user-id>| Uninstalls an application based on the specified bundle name and user.|
91| bm uninstall -n <bundle-name> -m <moudle-name> | Uninstalls a specific module of an application based on the specified bundle name.|
92
93* Example
94```Bash
95# Uninstall a HAP.
96bm uninstall -n com.ohos.app
97# Uninstall an ability of the HAP.
98bm uninstall -n com.ohos.app -m com.ohos.app.MainAbility
99```
100#### Query Command
101This 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.
102| Command| Description|
103| ---------- | -------------------------- |
104| bm dump -h | Displays the commands supported by **dump**.|
105| bm dump -a | Queries all applications installed in the system.|
106| bm dump -i | Queries details about all applications installed in the system.|
107| bm dump -n <bundle-name> | Queries details about a specified bundle.|
108| bm dump -n <bundle-name> -s | Queries the shortcut information of a specified bundle.|
109| bm dump -n <bundle-name> -d <device-id> | Queries information about a bundle on a remote device.|
110| bm dump -n <bundle-name> -u <user-id> | Queries details about a specified bundle of a specified user.|
111
112* Example
113```Bash
114# Display the names of all applications installed in the system.
115bm dump -a
116# Display details about a specific application.
117bm dump -n com.ohos.app
118```
119#### Clean Command
120If **-u** is not specified, the command applies to all active users.
121| Command| Description|
122| ---------- | -------------------------- |
123| bm clean -h | Displays the commands supported by **clean**.|
124| bm clean -n <bundle-name> -c | Clears the cache data of the specified bundle.|
125| bm clean -n <bundle-name> -d | Clears the data directory of the specified bundle.|
126| bm clean -n <bundle-name> -c -u <user-id> | Clears the cached data of the specified bundle for the specified user.|
127| bm clean -n <bundle-name> -d -u <user-id> | Clears the data directory of the specified bundle for the specified user.|
128
129* Example
130```Bash
131# Clear the cache data of the specified bundle.
132bm clean -n com.ohos.app -c
133# Clear the user data of the specified bundle.
134bm clean -n com.ohos.app -d
135```
136#### Enable Command
137If **-u** is not specified, the command applies to all active users.
138| Command| Description|
139| ---------- | -------------------------- |
140| bm enable -h | Displays the commands supported by **enable**.|
141| bm enable -n <bundle-name> | Enables the application that matches the specified bundle name.|
142| bm enable -n <bundle-name> -a <ability-name> | Enables a specific ability module of the application that matches the specified bundle name.|
143| bm enable -n <bundle-name> -u <user-id>| Enables the application that matches the specified bundle name for the specified user.|
144
145* Example
146```Bash
147# Enable the specified application.
148bm enable -n com.ohos.app
149```
150#### Disable Command
151If **-u** is not specified, the command applies to all active users.
152| Command| Description|
153| ---------- | -------------------------- |
154| bm disable -h | Displays the commands supported by **disable**.|
155| bm disable -n <bundle-name> | Disables the application that matches the specified bundle name.|
156| bm disable -n <bundle-name> -a <ability-name> | Disables a specific ability module of the application that matches the specified bundle name.|
157| bm disable -n <bundle-name> -u <user-id>| Disables the application that matches the specified bundle name for the specified user.|
158
159* Example
160```Bash
161# Disable the specified application.
162bm disable -n com.ohos.app
163```
164#### Command for Obtaining the UDID
165| Command| Description|
166| ---------- | -------------------------- |
167| bm get -h | Displays the commands supported by **get**.|
168| bm get -u | Obtains the UDID of a device.|
169
170* Example
171```Bash
172# Obtain the UDID of a device.
173bm get -u
174```
175
176## Repositories Involved
177
178Bundle Management Subsystem
179
180**appexecfwk_standard**
181
182developtools_packing_tool
183