No, HarmonyOS is not an Android fork, and here is what it is.

Nickolay Ilyushin
5 min readFeb 4, 2021

--

Some time ago I had published an article on Telegraph regarding some good (from programmer’s point of view) ideas implemented in HarmonyOS, but, welp, I was unable to actually show it anywhere, due to social media blocking links to Telegraph and me not having other ways of publishing by then.

Who am I?

I am a self-taught 18 years old programming hobbyist, using GNU/Linux as my primary platform. Have been interested in HarmonyOS since the beginning of 2020.

So, what is HarmonyOS, by Huawei’s definition?

Let’s open this page from Huawei’s official documentation.

1. Distributed

First paragraph seems mostly marketing-targeted for me, but here is the first keyword — it is a distributed operating system.

What does that mean? It means that you can have multiple nodes, (in case of HarmonyOS these are devices) which perform their specific functions and can talk to each other, preferably in a secure manner.

An already existing example from real world is Kubernetes, which allows you to manage a set of so-called microservices, which closely resemble the nodes I’ve mentioned above by idea. Kubernetes has other good functions, but let’s leave that to DevOps people, and continue with describing HarmonyOS.

2. Multi-architecture

If you are an application developer, HarmonyOS adopts distributed technologies to make your application development possible on different device forms. With HarmonyOS, you will have the choice to focus on upper-layer service logic and develop applications in a much easier and more efficient way.

If you are a device developer, HarmonyOS uses a component-based software design to tailor itself to your particular device forms based on their respective resource capabilities and service characteristics.

What does this mean? This means that HarmonyOS can run on multiple device architectures, which can vary by CPU architecture, amounts of resources (I will elaborate on this a bit later), peripheral devices, et cetera.

This is a characteristic of most operating systems though, and as such, we should not focus on this.

3. Layered architecture.

And here is an interesting statement:

HarmonyOS is designed with a layered architecture, which from bottom to top consists of the kernel layer, system service layer, framework layer, and application layer. System functions are expanded by levels, from system to subsystem, and further to function/module. In multi-device deployment scenario, unnecessary subsystems, functions, or modules can be excluded from the system as required. The following shows the technical architecture of HarmonyOS.

What do we see here?

  1. Kernel Abstraction Layer. As we can see, HarmonyOS can run under multiple kernels, such as Linux or LiteOS A/M (yes, there are two different LiteOS kernels, feel free to look at their gitee). This is definitely achievable with some additional hacks to the kernel, and even without them (look at Wine).
  2. Driver subsystem. It seems to run alongside the kernel, not inside like in most operating systems. This seems harder to achieve, but still possible — for example, if you run the kernel under a hypervisor (basically a virtual machine engine implemented as a separate operating system or a piece of hardware).
  3. Other layers. These are composable both at firmware generation time and at user’s will (to some extent).

4. Ark compiler and runtime

If you look at the image above again, you will notice a so-called Ark multi-language runtime.

Anyways, if we look at their gitee and another gitee, we can notice that:

  1. There is a MAPLE FE compiler, which seems to compile Java (and, in future, other languages) into MAPLE IR, which is close to JVM bytecode and Web Assembly by idea. Some time ago there was C++ support in the OpenArkCompiler repository, but now it’s gone. I expect it to appear in the MAPLE FE repository.
  2. There are MAPLE Engine and MAPLEALL, which take care of running MAPLE IR on supported devices. These include core runtime libraries, debugging tools, IR compilers, etc.
  3. OpenArkCompiler seems to become just utilizing the components above, although I might be wrong here.

What does this mean for us? Developers will be able to follow the “write once, run anywhere” idea in a better way, where their HarmonyOS application, even with C++ parts, will be compiled once, for MAPLE IR (instead of x86_64 or ARM), and then deployed to devices. This reduces compile time and allows running applications at near native speed, at the cost of additional memory use (which can be heavily reduced if you take additional steps at app install process though).

What does this mean for users? Probably nothing, because EMUI users already know benefits of using Ark compiler.

5. It is kernel agnostic.

Thanks to the Kernel Abstraction Layer, HarmonyOS can run under any kernel which has proper support for KAL and HDF (Hardware Driver Foundation).

And this part allows running Android apps, because Android uses Linux kernel, which can be used in HarmonyOS too.

How is HarmonyOS not Android if it can run Android apps and responds to ADB?

In GNU/Linux world there is a tool called Anbox. It allows running an Android distribution inside of an isolated container, which is provided by the Linux kernel.

It runs the whole operating system inside of the container, with it’s UI (heavily altered to fit an existing desktop though), it’s services (and even Google services if you manage to install them), it’s apps, it’s ADB.

Does this fact make the host GNU/Linux OS a fork of Android? No. To me level of absurd of such statements is similar to using the PC word to mention Windows just because Microsoft makes contracts with manufacturers so they preinstall the OS. But that’s another question.

Another example is Wine which is often used to run Windows apps on GNU/Linux and macOS. It reimplements the Win32 API from scratch, but it doesn’t make your Linux machines and macs actual Windows PCs.

Okay, but how can I tell this is not Android? I can’t. But I can’t say otherwise — this is a question to those who have gained access to the SDK and virtual machines. Have you guys tried running apps written using HarmonyOS SDK and not Android SDK? Have you tried using HarmonyOS debugger (yes it is a fork of ADB according to these screenshots, but that doesn’t make them compatible at the protocol level) on the virtual machines?

I judge from documentation and sources which are already public. If you don’t want to try using HarmonyOS-specific tools, wait for their open source release later in 2021, and stop making fake politicized (ArsTechnica!!!) news just because it looks like Android.

Another important note is that Huawei claims the EMUI design will only be used in developer versions of HarmonyOS, not in complete consumer ones. But we cannot neither confirm nor refute that, as there are only claims, but neither sources nor screenshots are available.

--

--