Hongmeng Development Example|Building Environment

 

On August 9, 2019, Huawei held the Huawei Developer Conference in Dongguan and officially released the Hongmeng operating system; in September 2020, it launched Hongmeng 2.0, which fully enables the full-scenario ecosystem and features cross-device, service transfer, extremely fast direct access, and visibility. It can be said that there are five major capabilities in privacy and security. At Huawei's new product launch conference on June 2, 2021, the Hongmeng mobile operating system officially debuted, which attracted widespread attention from social media. It also set off a wave of domestic updates to the Hongmeng operating system and learning from Hongmeng development.

This article mainly introduces the introduction to the development of Hongmeng operating system, and introduces what Hongmeng operating system is from the characteristics, technical architecture and technical characteristics of Hongmeng operating system. In terms of development, it introduces the establishment of development environment, creating Hongmeng applications, and deploying Hongmeng applications to the simulator.

01. Overview of Hongmeng system

It is said that in the ancient times of Chinese mythology, before the Pangu Kunlun Mountains created the world, the world was a mass of chaotic vitality. This natural vitality was called Hongmeng, so people called that era the Hongmeng Era. Later, the term was often used in general. Refers to ancient times. On August 9, 2019, Huawei held the Huawei Developer Conference in Dongguan and officially released the Hongmeng operating system (HarmonyOS or HongmengOS). According to the official definition, Hongmeng system is a future-oriented distributed operating system for all scenarios (mobile office, sports and health, social communication, media entertainment, etc.).

analyze

Hongmeng operating system is similar to Android operating system, but it also has its own advantages. This section mainly analyzes Hongmeng operating system from the aspects of system characteristics, technical architecture and technical characteristics.

1Features of Hongmeng OS

The advantage of Huawei's Hongmeng operating system is its high fluency and cross-platform applicability. This system is mainly a full-scenario distributed operating system based on microkernels, which can be expanded as needed to achieve broader system security. Its main feature is very low latency, which can even reach millisecond level or even sub-millisecond level. On the basis of the traditional single-device system capabilities, Hongmeng OS proposes a distributed concept based on the same set of system capabilities and adapted to multiple terminal forms, and can support multiple terminal devices.

Hongmeng operating system has the following three major characteristics.

(1) Devices equipped with this operating system are integrated at the system level to form a super terminal, so that the hardware capabilities of the device can be flexibly expanded, enabling hardware mutual assistance and resource sharing between devices.

For consumers, Hongmeng operating system can integrate the capabilities of various terminals in daily life scenarios, achieve rapid connection, mutual assistance, and resource sharing between different terminal devices, match appropriate devices, and provide a smooth full-scenario experience.

(2) For developers, achieve one-time development and multi-end deployment.

For application developers, Hongmeng OS uses a variety of distributed technologies to make application development independent of the differences in the form of different terminal devices, allowing developers to focus on upper-level business logic and develop applications more conveniently and efficiently.

(3) An operating system can meet the needs of devices with different capabilities, achieving a unified operating system and flexible deployment.

For device developers, Hongmeng operating system adopts a componentized design solution that can be flexibly tailored according to the device's resource capabilities and business characteristics to meet the operating system requirements of different types of terminal devices.

Hongmeng Operating System provides APIs that support multiple development languages ​​for developers to develop applications. Supported development languages ​​include Java, XML (Extensible Markup Language), C/C++, JS (JavaScript), CSS (Cascading Style Sheets) and HML (HarmongOS Markup Language).

2Technical architecture of Hongmeng operating system

Hongmeng operating system as a whole follows a layered design, from bottom to top: kernel layer, system service layer, application framework layer and application layer. System functions are expanded step by step according to "System → Subsystem → Function/Module". In a multi-device deployment scenario, some non-essential subsystems or functions/modules are supported according to actual needs. The technical architecture of Hongmeng operating system is shown in Figure 1.

■ Figure 1 Hongmeng operating system technical architecture

1. kernel layer

(1) Kernel subsystem. Hongmeng operating system adopts a multi-core design to support the selection of appropriate operating system kernels for different resource-constrained devices. The Kernel Abstract Layer (KAL) provides basic kernel capabilities to the upper layer by shielding the differences between multiple cores, including process/thread management, memory management, file system, network management, and peripheral management.

(2) Drive subsystem. The Hongmeng OS Driver Framework (HDF) is the basis for the openness of the Hongmeng OS hardware ecosystem, providing unified peripheral access capabilities and a driver development and management framework.

2. System service layer

The system service layer is the core capability set of Hongmeng operating system, which provides services to applications through the framework layer. This layer contains the following parts.

(1) System basic capability subsystem set: Provides basic capabilities for the operation, scheduling, migration and other operations of distributed applications on multiple Hongmeng operating system devices. It consists of distributed soft bus, distributed data management, distributed task scheduling, Ark consists of multi-language runtime, public basic library, multi-mode input, graphics, security, AI and other subsystems. Among them, the Ark runtime subsystem provides C/C++/JS multi-language runtime and basic system class libraries. It also provides static Java programs using the Ark compiler (that is, the parts of the application or framework layer developed using the Java language. ) provides the runtime.

(2) Basic software service subsystem set: Provides public and general software services for Hongmeng operating system, consisting of event notification, telephone, multimedia, DFX, MSDP&DV and other subsystems.

(3) Enhanced software service subsystem set: Provide Hongmeng operating system with differentiated capability-enhanced software services for different devices, consisting of smart screen proprietary business, wearable proprietary business, IoT proprietary business and other subsystems.

(4) Hardware service subsystem set: Provides hardware services for Hongmeng operating system, consisting of subsystems such as location services, biometric identification, wearable proprietary hardware services, and IoT proprietary hardware services.

According to the deployment environment of different device forms, the basic software service subsystem set, enhanced software service subsystem set, and hardware service subsystem set can be tailored according to subsystem granularity, and each subsystem can be tailored according to function granularity.

3.application framework layer

The application framework layer provides multi-language user program framework Ability frameworks such as Java/C/C++/JavaScript for Hongmeng operating system applications, as well as multi-language framework APIs for various software and hardware services that are open to the outside world; at the same time, it provides Hongmeng operating system applications with multi-language user program framework Ability frameworks. The device provides multi-language framework APIs such as C/C++/JavaScript. The APIs supported by different devices are related to the degree of component tailoring of the system.

4.Application layer

The application layer includes system applications and third-party non-system applications. Hongmeng OS applications consist of one or more FA (Feature Ability) or PA (Particle Ability). Among them, FA has a UI interface and provides the ability to interact with users; while PA has no UI interface and provides the ability to run tasks in the background and a unified data access abstraction. Applications developed based on FA/PA can implement specific business functions, support cross-device scheduling and distribution, and provide users with a consistent and efficient application experience.

3Technical characteristics of Hongmeng operating system

1. Hardware mutual assistance, resource sharing

1) Distributed soft bus

The distributed soft bus is a unified base for a variety of terminal devices. It provides unified distributed communication capabilities for the interconnection between devices. It can quickly discover and connect devices, and efficiently distribute tasks and transmit data. The schematic diagram of the distributed soft bus is shown in Figure 2.

 

■ Figure 2 Schematic diagram of distributed soft bus

2) Distributed device virtualization

The distributed device virtualization platform can realize resource integration, device management, and data processing of different devices. Multiple devices together form a super virtual terminal. For different types of tasks, we match and select execution hardware with appropriate capabilities for users, allowing services to flow continuously between different devices and giving full play to the resource advantages of different devices. The schematic diagram of distributed device virtualization is shown in Figure 3.

 

■ Figure 3 Schematic diagram of distributed device virtualization

3) Distributed data management

Distributed data management is based on the capabilities of distributed soft buses to achieve distributed management of application data and user data. User data is no longer bound to a single physical device, business logic is separated from data storage, and data is seamlessly connected when applications run across devices, creating basic conditions for creating a consistent and smooth user experience. The schematic diagram of distributed data management is shown in Figure 4.

■ Figure 4 Schematic diagram of distributed data management

4) Distributed task scheduling

Distributed task scheduling is based on technical features such as distributed soft bus, distributed data management, and distributed Profile to build a unified distributed service management (discovery, synchronization, registration, and invocation) mechanism to support remote startup of cross-device applications. Operations such as remote calling, remote connection, and migration can select appropriate devices to run distributed tasks based on the capabilities, locations, business operating status, resource usage, and user habits and intentions of different devices. Figure 5 takes application migration as an example to briefly demonstrate the distributed task scheduling capability.

■ Figure 5 Schematic diagram of distributed task scheduling

2. Develop once and deploy on multiple terminals

Hongmeng OS provides user program framework, Ability framework and UI framework, which supports the reuse of business logic and interface logic of multiple terminals during the application development process, enabling one-time development and multi-terminal deployment of applications, improving the development efficiency of cross-device applications. . The schematic diagram of one-time development and multi-terminal deployment is shown in Figure 6.

■ Figure 6 Schematic diagram of one-time development and multi-terminal deployment

3.Unified operating system, flexible deployment

Through design methods such as componentization and miniaturization, Hongmeng operating system supports on-demand flexible deployment of a variety of terminal devices and can adapt to different types of hardware resources and functional requirements. It supports the automatic generation of component dependencies through compilation chain relationships, forming a component tree dependency graph, supporting the convenient development of product systems and lowering the development threshold of hardware devices.

(1) Supports the selection of each component (components are optional). Depending on the form and needs of the hardware, the required components can be selected.

(2) Support the configuration of function sets within components (components can be large or small). Based on the hardware resources and functional requirements, you can choose to configure the function set in the component. For example, choose to configure some controls in the Graphics Frame component.

(3) Support the dependency association between components (the platform can be large or small). Based on the compilation chain relationship, componentized dependencies can be automatically generated. For example, selecting a graphics framework component will automatically select dependent graphics engine components, etc.

02. Build Hongmeng operating system environment

The Hongmeng operating system development environment is based on the Java development environment. To facilitate development, Huawei's official website provides the integrated tool DevEco Studio. The compilation and construction of DevEco Studio relies on JDK. DevEco Studio is preset with Open JDK, version 1.8, and JDK will be automatically installed during the installation process. To ensure the normal operation of DevEco Studio, it is recommended that the computer configuration meets the following requirements: operating system is Windows 10 64-bit, memory 8GB or above, hard disk 100GB or above, resolution 1280×800px or above.

analyze

During the development process, you can choose to use the JS UI framework for UI interface development, so the Hongmeng operating system environment construction includes DevEco Studio and Node. js download and installation.

1Node.js download and installation

Node. js is used to develop JavaScript applications and run preview functions. It is an essential software in the process of developing Hongmeng operating system applications. Log in to Node. js official website, download Node.js package. Select the LTS version and the software package corresponding to Windows 64-bit, see Figure 7.

■ Figure 7 Node. js official website

Click the downloaded software package to install it, and click the Next button according to the default settings until Finish. During the installation process, Node. js will automatically configure node in the system's path environment variable. The directory path of the exe.

2Download and install DevEco Studio

(1) Log in to the Hongmeng OS application development portal, click the "Register" button in the upper right corner, and register a developer account. For registration instructions, please refer to Registering a Huawei Account. If you already have a Huawei developer account, click the "Login" button directly.

illustrate

Using the DevEco Studio remote simulator requires a Huawei account for real-name authentication. It is recommended that you submit a real-name authentication review immediately after registering a Huawei account. The authentication methods include "personal real-name authentication" and "enterprise real-name authentication." For details, please refer to real-name authentication.

(2) Enter the HUAWEI DevEco Studio product page and download the DevEco Studio installation package.

(3) Double-click the downloaded "deveco-studio-xxxx.exe" to enter the DevEco Studio installation wizard. After checking the DevEco Studio launcher checkbox on the installation options interface, click the Next button until the installation is completed, as shown in Figure 8 .

 ■ Figure 8 DevEco Studio installation wizard

Guess you like

Origin blog.csdn.net/qq_41640218/article/details/132800479
Recommended