harmony 鸿蒙Multi-HAP Operation Mechanism and Data Communication Modes

  • 2023-02-03
  • 浏览 (645)

Multi-HAP Operation Mechanism and Data Communication Modes

The multi-HAP mechanism is used to facilitate modular management for developers. There is no one-to-one mapping between the HAP and the running process of the application. The detailed running mechanism is as follows:

  • By default, all UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility components of an application (with the same bundle name) run in the same independent process (known as the main process), and other ExtensionAbility components of the same type run in separate processes.

  • The HAP file supports the process configuration through the process tag in the module.json5 (stage model) or config.json (FA model) file. This feature is supported only by system applications. If process is configured for an HAP file, all components of the HAP file run in an independent process. Multiple HAP files can be configured with the same process, in which case the HAP files run in the same process. For details about the process configuration, see module.json5 Configuration File.

  • When an application is running, the resources and code of the corresponding HAP file are loaded only when the UIAbility component in the same process is started.

Based on the preceding mechanism, the multi-HAP data communication modes are as follows:

  • For details about data communication in the same process, see Thread Model (Stage Model).

  • For details about cross-process data communication, see Process Model (Stage Model).

  • If multiple HAPs run in the same process, the communication mode between the components of multiple HAP files is the same as that between the components of the same HAP file.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Quick Start

harmony 鸿蒙app.json5 Configuration File

harmony 鸿蒙Internal Structure of the app Tag

harmony 鸿蒙Application Configuration File Overview (FA Model)

harmony 鸿蒙Application Configuration File Overview (Stage Model)

harmony 鸿蒙Application Installation and Uninstallation Process

harmony 鸿蒙Application Package Overview

harmony 鸿蒙Application Package Structure in FA Model

harmony 鸿蒙Application Package Structure in Stage Model

harmony 鸿蒙Application Package Update Process

0  赞