harmony 鸿蒙Bundle Management

  • 2022-08-09
  • 浏览 (522)

Bundle Management

Introduction

The Bundle Management subsystem allows you to query, install, update, and uninstall capabilities for application bundles as well as store bundle information.

Below is the architecture of the Bundle Management subsystem.

Responsibilities of Modules

Module Description
Bundle management interface module 1. Provides external interfaces for installation, update, uninstallation, and notification.
2. Provides external interfaces for querying bundle, component, and permission information.
3. Provides external interfaces for querying application permissions.
4. Provides external interfaces for clearing data.
Scanning module 1. Scans pre-installed applications.
2. Scans installed third-party applications.
3. Parses bundle configuration files.
Security management module 1. Verifies signatures during installation.
2. Grants the permissions requested by the application during installation.
3. Verifies permissions during application running.
DBMS module Obtains the ability information about a specified device.
Installation management module Provides installation, update, and uninstallation logic processing and result notification.
Bundle information management module Stores and synchronizes bundle and component information.
Device status listening module Listens for the online and offline status changes of devices.
Installed module Provides privileged processes for:
(1) Creating and deleting directories
(2) Creating and deleting files
(3) Sandbox UID/GID operations in the device directory
DFX Provides bundle maintenance and testing.

Directory Structure

foundation/bundlemanager/bundle_framework
├── bundle_tool                        # bm code
├── distributed_bundle_framework       # Framework code of the distributed bundle management service					   
├── common
│   └── log							   # Log component
├── interfaces
│   ├── inner_api                      # Internal APIs
│   └── kits                           # Application APIs
│       ├── js                         # JS APIs
│       └── native                     # C/C++ APIs  					   
├── services                           # Framework code of the bundle management service
└── test						       # Testing

bm Commands

bm 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. |Command |Description | |——-|———-| | help|Displays the commands supported by the bm tool.| |install|Installs an application.| |uninstall|Uninstalls an application.| |dump|Queries application information.| |clean|Clears the cache and data of an application.| |enable|Enables an application.| |disable|Disables an application.| |get|Obtains the UDID of a device.|

Help Command

Command Description
bm help Displays the commands supported by the bm tool.
  • Example

    # Display help information.
    bm help
    

    Installation Command

    This command can be run with different options to achieve different purposes. The table below lists some examples. |Command |Description | |———————————–|————————–| |bm install -h|Displays the commands supported by install.| |bm install -p |Installs HAPs. You can specify a path to install one or more HAPs at the same time.| |bm install -p -u |Installs a HAP for a specified user.| |bm install -r -p |Installs a HAP in overwrite mode.| |bm install -r -p -u |Installs a HAP for a specified user in overwrite mode.|

  • Example

    # Install a HAP.
    bm install -p /data/app/ohosapp.hap
    # Install a HAP in overwrite mode.
    bm install -p /data/app/ohosapp.hap -r
    

    Uninstallation Command

    This 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. |Command |Description | |—————————–|————————| |bm uninstall -h|Displays the commands supported by uninstall.| |bm uninstall -n |Uninstalls an application based on the specified bundle name.| |bm uninstall -n -k|Uninstalls an application based on the specified bundle name, while retaining the data directory of the application.| |bm uninstall -n -u |Uninstalls an application based on the specified bundle name and user.| |bm uninstall -n -m |Uninstalls a specific module of an application based on the specified bundle name.|

  • Example

    # Uninstall a HAP.
    bm uninstall -n com.ohos.app
    # Uninstall a HAP while retaining its data directory.
    bm uninstall -n com.ohos.app -k
    # Uninstall an ability of the HAP.
    bm uninstall -n com.ohos.app -m com.ohos.app.MainAbility
    

    Query Command

    This 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. |Command |Description | |———-|————————–| |bm dump -h|Displays the commands supported by dump.| |bm dump -a|Queries all applications installed in the system.| |bm dump -n |Queries details about a specified bundle.| |bm dump -n -s|Queries the shortcut information of a specified bundle.| |bm dump -n -d |Queries information about a bundle on a remote device.| |bm dump -n -u |Queries details about a specified bundle of a specified user.|

  • Example

    # Display the names of all applications installed in the system.
    bm dump -a
    # Display details about a specific application.
    bm dump -n com.ohos.app
    

    Clean Command

    -If -u is not specified, the command applies to all active users. |Command |Description | |———-|————————–| |bm clean -h|Displays the commands supported by clean.| |bm clean -n -c|Clears the cache data of the specified bundle.| |bm clean -n -d|Clears the data directory of the specified bundle.| |bm clean -n -c -u |Clears the cached data of the specified bundle for the specified user.| |bm clean -n -d -u |Clears the data directory of the specified bundle for the specified user.|

  • Example

    # Clear the cache data of the specified bundle.
    bm clean -n com.ohos.app -c
    # Clear the user data of the specified bundle.
    bm clean -n com.ohos.app -d
    

    Enable Command

    -If -u is not specified, the command applies to all active users. |Command |Description | |———-|————————–| |bm enable -h|Displays the commands supported by enable.| |bm enable -n |Enables the application that matches the specified bundle name.| |bm enable -n -a |Enables a specific ability module of the application that matches the specified bundle name.| |bm enable -n -u |Enables the application that matches the specified bundle name for the specified user.|

  • Example

    # Enable the specified application.
    bm enable -n com.ohos.app
    

    Disable Command

    -If -u is not specified, the command applies to all active users. |Command |Description | |———-|————————–| |bm disable -h|Displays the commands supported by disable.| |bm disable -n |Disables the application that matches the specified bundle name.| |bm disable -n -a |Disables a specific ability module of the application that matches the specified bundle name.| |bm disable -n -u |Disables the application that matches the specified bundle name for the specified user.|

  • Example

    # Disable the specified application.
    bm disable -n com.ohos.app
    

    Command for Obtaining the UDID

    Command Description
    bm get -h Displays the commands supported by get.
    bm get -u Obtains the UDID of a device.
  • Example

    # Obtain the UDID of a device.
    bm get -u
    

Repositories Involved

Bundle Management Subsystem

bundlemanager_bundle_framework

bundlemanager_bundle_framework_lite developtools_packing_tool

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkCompiler Runtime

harmony 鸿蒙DeviceProfile

harmony 鸿蒙System Ability Manager

harmony 鸿蒙Security

harmony 鸿蒙Ability Framework

harmony 鸿蒙Account

harmony 鸿蒙AI

harmony 鸿蒙ArkUI

harmony 鸿蒙Common Event and Notification

harmony 鸿蒙Compilation and Building

0  赞