<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ying xu</title>
    <description>The latest articles on DEV Community by ying xu (@ying_xu_0f8a58231902eb42b).</description>
    <link>https://dev.to/ying_xu_0f8a58231902eb42b</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4043455%2Fa1b9cc73-0046-4723-b2b6-24d100edfbd5.png</url>
      <title>DEV Community: ying xu</title>
      <link>https://dev.to/ying_xu_0f8a58231902eb42b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ying_xu_0f8a58231902eb42b"/>
    <language>en</language>
    <item>
      <title>Technical Analysis: How to Run Android Apps Natively on Linux?</title>
      <dc:creator>ying xu</dc:creator>
      <pubDate>Mon, 27 Jul 2026 09:53:12 +0000</pubDate>
      <link>https://dev.to/ying_xu_0f8a58231902eb42b/technical-analysis-how-to-run-android-apps-natively-on-linux-acm</link>
      <guid>https://dev.to/ying_xu_0f8a58231902eb42b/technical-analysis-how-to-run-android-apps-natively-on-linux-acm</guid>
      <description>&lt;p&gt;It is well known that the Android system runs on the Linux kernel . However, Android's rich and mature software ecosystem stands in stark contrast to that of Linux ; given that they share the same kernel, why can't Android applications run directly on Linux? &lt;/p&gt;

&lt;p&gt;There are currently two main technical solutions for running Android on Linux: &lt;strong&gt;virtual machines&lt;/strong&gt; and &lt;strong&gt;containerization&lt;/strong&gt; . Virtual machines consume significant hardware resources and result in complete isolation—preventing interaction between the two systems—whereas containerization avoids these drawbacks, making it our preferred choice . Specifically, containerization effectively carves out a dedicated space for Android to run within the Linux environment while maintaining a channel for interaction between the two systems .&lt;/p&gt;

&lt;p&gt;Therefore, based on this, we decided to create an open-source desktop, &lt;strong&gt;OpenFDE&lt;/strong&gt;, which allows Android applications to run directly on Linux systems .&lt;/p&gt;

&lt;p&gt;To provide a better understanding of our open-source project, this article outlines OpenFDE's software architecture and display logic .&lt;/p&gt;




&lt;h2&gt;
  
  
  1. OpenFDE Overall Software Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌────────────────────────────────────────────────────────────────────────────────────────┐
│                                   Application Layer                                    │
│   ┌────────────────────────┬────────────────────────┐      ┌────────────┬──────────┐   │
│   │     Android App1       │      Android App2      │      │  X11 APP1  │ X11 APP1 │   │
│   └────────────────────────┴────────────────────────┘      └─────┬──────┴────┬─────┘   │
│                                                                  │           │         │
│                                                            ┌─────▼───────────▼──────┐  │
│                                                            │        XServer         │  │
│                                                            └────────────┬───────────┘  │
├─────────────────────────────────────────────────────────────────────────┼──────────────┤
│                                  API Framework Layer                    │              │
│   ┌────────────────────────┬────────────────────────┐  ┌────────────────▼───────────┐  │
│   │    Activity Manager    │     Window Manager     │  │   X11 Client (libX11, etc) │  │
│   ├────────────────────────┼────────────────────────┤  ├────────────────────────────┤  │
│   │    Content Providers   │      View System       │  │    DIX Driver (wiglamor)   │  │
│   ├────────────────────────┼────────────────────────┤  │            Glamor          │  │
│   │    Resource Manager    │    Location Manager    │  ├────────────────────────────┤  │
│   ├────────────────────────┴────────────────────────┤  │    EGL / GLX / OpenGL/ES   │  │
│   │             Android Runtime (ART)               │  ├────────────────────────────┤  │
│   └─────────────────────────────────────────────────┘  │   User-space Drivers       │  │
├────────────────────────────────────────────────────────┤   (libGL-Mesa-DRI, Mesa3D) │  │
│                                     Native Libs        │  ├────────────────────────────┤  │
│   ┌────────────────────────┬────────────────────────┐  │      LibDRM / GNU LibC     │  │
│   │          SSL           │        Graphics        │  └────────────────────────────┘  │
│   ├────────────────────────┴────────────────────────┤             ▲                    │
│   │   AOSP LibC with Modified Dynamic Libs Loader   │─────────────┘                    │
├─────────────────────────────────────────────────────┴──────────────────────────────────┤
│                           LXC Isolation and Fusion Layer                               │
│   ┌──────────────────┬──────────────────┬──────────────────┬──────────────────────┐    │
│   │ Filesystem Fusion│  Network Fusion  │  IPC Fusion &amp;amp;    │   Clipboard Fusion   │    │
│   │                  │                  │   Acceleration   │                      │    │
│   └──────────────────┴──────────────────┴──────────────────┴──────────────────────┘    │
├────────────────────────────────────────────────────────────────────────────────────────┤
│                           Standard Desktop Device Drivers                              │
├────────────────────────────────────────────────────────────────────────────────────────┤
│                                 Standard Linux Kernel                                  │
└────────────────────────────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The image above illustrates our current overall technical architecture . From the bottom up, the architecture comprises :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Standard Linux Kernel&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LXC Isolation and Integration Layer&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Framework Layer&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application Layer&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux Desktop Graphics Stack&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let us examine each of these components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Application Layer&lt;/strong&gt;: The FDE application layer primarily encompasses Android applications and Linux X11 applications . While Android applications run natively, Linux X11 applications operate within the Linux system; we integrate their display into the Android environment using a VNC client running within FDE, while simultaneously forwarding input events (such as keyboard/mouse signals and IME inputs) . We are currently developing an Android-based X Server to replace the Linux-based VNC X Server, aiming to achieve superior display performance and enhanced compatibility .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API Framework Layer&lt;/strong&gt;: It provides a set of standard API interfaces that enable applications to communicate and interact with the underlying system; these APIs cover functions such as accessing device drivers, managing file systems, and handling network communications . OpenFDE directly inherits the Android API design framework, ensuring that both adhere to a unified set of APIs for peripherals and power management . This significantly alleviates issues associated with the coexistence of different API generations, as well as the haphazard and chaotic nature of modifications during the usage and development of graphical interfaces .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LXC Isolation and Integration Layer&lt;/strong&gt;: The LXC isolation layer isolates the Linux and Android file systems and API layers while sharing the underlying Linux kernel . The integration layer leverages standard desktop protocols (such as Wayland) and the Linux desktop graphics stack to provide key functions like graphical display, input device management, and window management . Additionally, we are working to package the Linux desktop graphics stack's OpenGL/ES components into dynamic libraries that can be called directly by Android, thereby ensuring compatibility with a wider range of hardware .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Display Integration Logic
&lt;/h2&gt;

&lt;p&gt;Having covered the overall software architecture of OpenFDE, let us now discuss how the display component is integrated—a particularly challenging aspect of the entire integration solution .&lt;/p&gt;

&lt;h3&gt;
  
  
  Standard Linux DRI Display Framework
&lt;/h3&gt;

&lt;p&gt;The logic of the DRI display framework on Linux (currently the most efficient display framework) is that the client directly invokes the GPU for rendering; once rendering is complete, the output is submitted to the compositor, which then performs composition and submits the result for display .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────┐    1. Render Request     ┌──────────────────┐
│ Client/App       ├─────────────────────────&amp;gt;│ GPU              │
└────────┬─────────┘                          └────────┬─────────┘
         │                                             │
         │ 2. Send Composition Request                 │ 3. Fetch Render Result
         ▼                                             ▼    for Composition
┌──────────────────┐                          ┌──────────────────┐
│ Compositor       ├─────────────────────────&amp;gt;│ DPU              │
└──────────────────┘    4. Send Composition   └──────────────────┘
                             Result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Native Android Display Logic
&lt;/h3&gt;

&lt;p&gt;Android's display logic involves the application requesting buffers from SurfaceFlinger; SurfaceFlinger invokes Gralloc to fulfill the request and synchronizes the result for the application's use . The rendering process is executed directly by the application using the GPU, and the final output is handed over to SurfaceFlinger, which invokes HWC (Hardware Composer) to perform composition .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 ┌──────────────────────────┐
                 │ Application (Self-Render)│&amp;lt;──────────┐
                 └─────┬──────────────┬─────┘           │
                       │              │                 │
  Submit Rendering     │              │ Apply Buffer    │ Return
  Results              │              │                 │
                       ▼              ▼                 │
┌─────────────┐   ┌─────────────────────────┐     ┌─────┴──────────┐
│ Display     │&amp;lt;──┤     surfaceflinger      ├────&amp;gt;│    gralloc     │
└──────▲──────┘   └───────────┬─────────────┘     └────────────────┘
       │                      │ Call
       │                      ▼
       │          ┌─────────────────────────┐
       └──────────┤  hwcomposer (Composition│
                  └─────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  OpenFDE Merged Display Architecture
&lt;/h3&gt;

&lt;p&gt;Running Android on Linux allows these two workflows to be merged :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The initial stages follow the standard Android process .&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hwcomposer&lt;/code&gt; is modified to act as a Wayland client (thereby losing hardware composition capabilities) .&lt;/li&gt;
&lt;li&gt;When &lt;code&gt;SurfaceFlinger&lt;/code&gt; requests composition from &lt;code&gt;hwcomposer&lt;/code&gt;, the latter returns data indicating that the GPU should handle the entire composition task .&lt;/li&gt;
&lt;li&gt;Consequently, &lt;code&gt;SurfaceFlinger&lt;/code&gt; invokes the GPU to perform the composition and sends the result to &lt;code&gt;hwcomposer&lt;/code&gt; for submission .&lt;/li&gt;
&lt;li&gt;Finally, &lt;code&gt;hwcomposer&lt;/code&gt; transmits the buffer via the Wayland protocol to the Linux compositor (&lt;code&gt;mutter&lt;/code&gt;), which then sends it to the Linux DPU for display .
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;               ┌──────────────────────────┐
               │    App (Self-rendering)  │&amp;lt;──────────┐
               └─────┬──────────────┬─────┘           │
                     │              │                 │
Submit Rendering     │              │ Request Buffer  │ Allocate
Results              │              │                 │
                     ▼              ▼                 │
┌─────────────┐ Ask  ┌──────────────┴──────┐     ┌─────┴──────────┐
│ hwcomposer  │&amp;lt;────┤    surfaceflinger    ├────&amp;gt;│    gralloc     │
│ (wayland    │     └──────────────▲───────┘     └────────────────┘
│   client)   ├────────────────────┘
└──────┬──────┘ Respond: ALL DONE BY GPU
       │
       │ Transmit Buffer via Wayland
       ▼
┌─────────────┐
│   mutter    │
│(Composition)│
└──────┬──────┘
       │
       ▼
┌─────────────┐
│   Display   │
└─────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, this approach entails some performance overhead, but it effectively achieves our objective .&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Summary &amp;amp; What's Next
&lt;/h2&gt;

&lt;p&gt;These are the two core components of how FDE currently operates . Beyond this, we have also worked on integrating Linux applications into Android, upgrading the UI, fine-tuning interactions, and more . &lt;/p&gt;

&lt;p&gt;In the next installment, we'll dive into the technical principles behind FDE's Linux application integration .&lt;br&gt;
"""&lt;/p&gt;

</description>
      <category>android</category>
      <category>linux</category>
      <category>software</category>
    </item>
  </channel>
</rss>
