Huawei officially unveiled its operating system HarmonyOS at a developer conference last August. After more than a year, hongmeng system officially upgraded to version 2.0 on September 10 this year. According to official plans, the mobile Beta will be available today (December 16th).

Over the past year, it seems that android developers around you don’t know much about HarmonyOS. At present, because Huawei has not opened the relevant content of Hongmeng mobile phone system, there is not enough eye-catching performance to attract the attention of mobile developers.

On December 9, Google officially open-source Fuchsia, the third operating system to be released after Android and ChromeOS.

Fuchsia system plays a crucial role in Google’s attempt to build an integrated ecosystem of multi-terminal systems. Fuchsia’s layered module design makes it easy to tailor customized operating systems for mobile phones, tablets, laptops, IoT and even in-car systems. Dart and Flutter have been paving the way for this for a few years now, with the slogan of developing multiple deployments on one end attracting many Android/ Web developers.

HarmonyOS is a next-generation system that moves in the direction of the Internet of everything, in the same direction as Fuchsia. HarmonyOS is committed to making its operating system self-reliant in China. In the future, Huawei will upgrade its terminal products to support HarmonyOS and encourage other vendors to adopt HarmonyOS.

As an Android developer, check in early to see what HarmonyOS is developing.

Overview and Understanding

HarmonyOS is a future-oriented distributed operating system for all scenarios (mobile office, sports and health, social communications, media and entertainment). Building on the traditional single-device system capabilities, HarmonyOS proposed a distributed concept based on the capabilities of the same system and adapted to multiple devices.

For consumers, HarmonyOS consolidates the capabilities of various devices in a life scenario into a single virtual terminal that enables fast connectivity, mutual assistance, resource sharing, matching of the right devices, and a seamless, full-scene experience.

In short, when you use harmonyOS-based terminal devices such as mobile phones, computers, IoT smart appliances, etc., it supports a better experience between devices. For example, you can use gestures to flick a file directly from the device screen to another device. Use smart screen to automatically adjust the brightness of environmental lights. These functions are no longer implemented on top of the system services based on certain protocols (such as Bluetooth, etc.), but are naturally supported within the system.

For application developers, HarmonyOS uses a variety of distributed technologies to make application development easier and cheaper regardless of the form factor of different devices. This allows developers to focus on upper-level business logic, making it easier and more efficient to develop applications.

In recent years multi – terminal unified development is very hot. For developers, a good multi-endpoint unified solution minimizes the cost of adaptation. The frameworks based on the front-end technology stack include Tencent Hippy, Didi Chameleon, JINGdong Taro, Ali Weex, Facebook RN, Ctrip CRN and Meituan MRN based on RN optimization, etc. Based on the Native stack, Flutter takes a different approach, racing ahead on the Native side and catching up on the Web /desktop side. HarmonyOS also allows developers to use one side of the code to adapt to multiple applications, which is an advantage over traditional Java/Kotlin android applications.

For device developers, HarmonyOS uses a component-based design solution that is tailored to the resource capabilities and service characteristics of the device to meet the operating system requirements of different terminal devices.

Like Fuchsia, HarmonyOS dynamically tailor system services based on the hardware capabilities and business requirements of the terminal.

Technical architecture vs Android

HarmonyOS follows a hierarchical design that includes the kernel layer, system service layer, framework layer, and application layer from bottom up.

System functions Are displayed by system > Subsystem > Functions/modules. In multi-device deployment scenarios, you can cut some unnecessary subsystems or functions/modules based on actual requirements. As shown in HarmonyOS technical Architecture.

The kernel layer

The kernel layer is divided into kernel subsystem and driver subsystem, whose function is to provide the basic kernel capability and unified call entry to the upper layer.

Kernel subsystem HarmonyOS is a multi-kernel design that allows you to select the appropriate OS kernel for different resource-constrained devices. The kernel abstraction Layer (KAL) provides basic kernel capabilities for the upper Layer, including process/thread management, memory management, file system, network management, and peripheral management, by shielding multi-kernel differences.

The Driver subsystem, HarmonyOS Driver Framework (HDF) is the foundation of the HarmonyOS open hardware ecosystem, providing unified peripherals access and a driver development and management framework.

System Service layer

The System Services layer is HarmonyOS ‘core set of capabilities that provide services to applications through the framework layer. This layer contains the following sections:

  1. System sets: basic ability subsystem for distributed application on HarmonyOS much equipment running, scheduling, migration and so on provides the basis capacity, operation by distributed soft bus, distributed data management, a distributed task scheduling, ark language runtime, public libraries, multimode input, graphics, security, AI and other subsystems. Among them, Ark runtime provides C/C++/JS multilanguage runtime and basic system class library, and also provides runtime for Java programs that use Ark compiler statically (that is, the part of the application or framework layer that uses Java language development).

  2. Basic Software Services Subsystem Set: HarmonyOS provides a common, common software service consisting of event notification, telephony, multimedia, DFX, MSDP & DV subsystems.

  3. Enhanced Software Services Subsystem set: HarmonyOS delivers differentiated and enhanced software services to HarmonyOS on different devices. It consists of smart screen proprietary, wearable proprietary, and IoT proprietary subsystems.

  4. Hardware Services Subsystem Set: HarmonyOS provides hardware services, comprising subsystems such as location services, biometrics, wearable proprietary hardware services, and IoT proprietary hardware services.

According to the deployment environment of different devices, the basic software service subsystem set, enhanced software service subsystem set, and hardware service subsystem set can be tailored according to the granularity of subsystems, and each subsystem can be tailored according to the granularity of functions.

The framework layer

The Framework layer provides HarmonyOS applications with a multi-language user application framework (Java/C/C++/JS) and the Ability framework, as well as a multi-language API open to various hardware and software services.

HarmonyOS also provides multi-language framework apis (C/C++/JS) for devices that use HarmonyOS. The apis supported by each device depend on the degree of component-based tailoring of the system.

The application layer

The application layer includes system applications and third-party non-system applications.

The application of HarmonyOS consists of one or more FA (Feature Ability) or PA (Particle Ability).

FA has A UI interface to provide the ability to interact with users. While PA has no UI, it provides the ability to run tasks in the background and a unified data access abstraction.

Applications developed based on FA/PA can implement specific service functions, support cross-device scheduling and distribution, and provide consistent and efficient application experience for users.

Vs Android architecture

The HarmonyOS architecture is a 4-layer architecture, while the Hardware Abstraction Layer in Android’s latest platform architecture is a 5-layer architecture.

Align the Android Architecture

  1. Harmony kernel layeralignmentAndroid Linux kernel and hardware abstraction layer, are based on kernel customization to provide the underlying functions and external hardware interface;
  2. Harmony system service layeralignmentAndroid Runtime and native C/C++ librariesBecause Harmony is designed for distributed applications, it has a distributed task/data/bus module and a multilingual runtime ark module. Other basic software services/hardware services are basically the same as Android, but Harmony is designed to be multi-terminal and uses a sub-system management approach to divide services.
  3. HarmonyFrame layer alignmentAndroid Java API FrameworkThis is the module that upper-level developers focus on the most.AndroidProvides the entire OS feature set, you can call the OS feature set API through Java/Kotlin;HarmonyProvides support for multilingual program framework andAbilityFrame, can be carried out according to different equipmentAPI and system constructionCut (castration, you might say).AbilitycontainsHarmonyAll feature sets provided.
  4. Harmony application layerThe Android application layer is basically the same from an app developer’s point of view.

Unique technical features

Harmony has three important technical features:

  • Hardware mutual assistance resource sharing
  • Develop multiple deployments at once
  • Unified OS elastic deployment

The first and third features of HarmonyOS provide a better service for service providers. This is reflected in HarmonyOS’s multi-terminal connectivity and efficient delivery. At the same time, distributed tasks and elastic deployment service functions can be optimized based on device capabilities.

For product developers, the second feature is by far the most attractive. Multiple deployments can be developed at one time without additional costs for multiple adaptations.

Hardware mutual assistance resource sharing

To realize multi – terminal interconnection, bus support is needed. Harmony provides a distributed soft bus for various terminal devices and unified distributed communication capabilities for interconnection between devices. Harmony can quickly discover and connect devices and efficiently distribute tasks and transmit data.

The different devices follow the Harmony communication protocol and communicate with the bus hub, which contains a management center for discovering, connecting, and managing multi-terminal devices, while the data and computing center participates in the transmission of data calculation and the decision center decides the policy delivery.

Distributed device virtualization is required for a single device to integrate resources, manage devices, and process data. Multiple devices can form a hypervirtual terminal through distributed device virtualization.

For different types of tasks, users can be matched and selected with appropriate execution hardware, so that services can be continuously transferred between different devices and the resource advantages of different devices can be fully exploited.

Based on distributed soft bus, application program data and user data can be managed in a distributed way. User data is no longer bound to a single physical device, service logic is separated from data storage, and data running across devices is seamlessly connected, creating a consistent and smooth user experience.

Based on distributed soft bus, distributed data management, distributed Profile and other technical features, Harmony builds a multi-terminal ecosystem to support the scheduling of distributed tasks.

Support to build a unified distributed services management (found, synchronization, registration, call) mechanism, support of equipment remote startup, the application of remote calls, remote connection and the migration operation, can according to the different equipment, location, business operation, the ability of resource usage, and the user’s habits and intention, choose the right equipment running distributed task.

Taking application migration as an example, the distributed task scheduling capability is briefly demonstrated.

Develop multiple deployments at once

HarmonyOS provides the user application framework, the Ability framework, and the UI framework to enable the reuse of multi-terminal business logic and interface logic during application development, enabling multiple applications to be developed at once and deployed at multiple ends, improving cross-device application development efficiency.

Unified OS elastic deployment

HarmonyOS supports flexible deployment of a variety of terminals on demand by using component-based and miniaturized design methods to meet different types of hardware resources and functional requirements. Support can automatically generate componentized dependency relationship through compiler chain relationship, form component tree dependency graph, support convenient development of product system, reduce the threshold of hardware development.

  1. Supports component selection(Optional components) : Select required components based on the hardware type and requirements.
  2. Supports the configuration of function sets within components(Components can be large or small) : You can configure the function set of a component based on the resource availability and functional requirements of the hardware. For example, select some controls in the Configuration Graphics Frame component.
  3. Supports correlation of dependencies between components(Platforms can be large or small) : Componentized dependencies can be automatically generated based on compilation chain relationships. For example, selecting a graphics frame component will automatically select dependent graphics engine components, etc.

opportunities

HarmonyOS is new to Android developers. It’s a brand new operating system, and the future of HarmonyOS and its developer ecosystem is unknown. However, it is also familiar. It supports Java language programming and development, and the design of Ability framework is similar to the design of Android API, which can be quickly learned by transferring Android development experience.

Harmony series of articles will follow from the perspective of Android development to grasp the application development of Hongmeng system, with the existing development experience to quickly start and master the application development, with interested friends to contribute to the Harmony OS development ecology.

Welcome to keep following me.

Welcome to the Android Zen account to share valuable and thoughtful technical articles with you. Can add wechat “Ming_Lyan” remarks “into the group” to join the technical exchange group, discussion of technical problems is strictly prohibited all advertising irrigation. If you have technical problems in the Android field or have doubts about your future career plan, discuss with us. Welcome to the party.