# piercingxx/fake-linux-phone architecture

> Architecture diagram of the GitHub repository piercingxx/fake-linux-phone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/piercingxx/fake-linux-phone
- Repository: https://github.com/piercingxx/fake-linux-phone

## Overview

FakeLinux is an Android app that provisions a private Termux Linux userspace and presents its i3 desktop through an embedded Termux:X11 server. Users set up the environment, start a session, and interact with Linux apps on the Android display; Android apps can also appear in the Linux launcher. The graph preserves documented setup, package/catalog, desktop, and integration capabilities. Some Flutter screens and runtime methods were not sampled, so their links are left unverified rather than inferred as direct calls.

Main entry points: [`app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/LinuxRuntime.kt`](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/LinuxRuntime.kt) (Linux runtime), [`app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt`](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt) (Desktop activity), [`app/lib/main.dart`](https://github.com/piercingxx/fake-linux-phone/blob/main/app/lib/main.dart) (Flutter interface), [`app/android/app/src/main/kotlin/com/piercingxx/linux/MainActivity.kt`](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/MainActivity.kt) (Android entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and setup"]
  node_flutter["Flutter interface<br/>[main.dart]"]
  node_setup["Setup screens"]
  node_catalog["App catalog"]
  node_platform["Platform bridge"]
  node_native["Android entry<br/>[MainActivity.kt]"]
end

subgraph group_linux["Linux environment"]
  node_runtime["Linux runtime<br/>[LinuxRuntime.kt]"]
  node_profile["Desktop profile<br/>[PiercingProfile.kt]"]
  node_linuxfiles["Bundled rice"]
end

subgraph group_desktop["Desktop session"]
  node_foreground["Session service"]
  node_desktop["Desktop activity<br/>[DesktopActivity.kt]"]
  node_surface["X11 display"]
  node_server["X11 server"]
  node_client["X11 client"]
  node_input["Touch input"]
  node_touch["Gesture handling"]
  node_sender["Event sender"]
  node_inputstub["Input injection<br/>[InputStub.java]"]
  node_renderdata["Display mapping<br/>[RenderData.java]"]
  node_prefs["X11 preferences<br/>[Prefs.java]"]
end

subgraph group_integration["Android integration"]
  node_androidapps["Android app bridge"]
  node_desktoplinks["Desktop integration"]
  node_clipboard["Clipboard sync<br/>[ClipboardSync.kt]"]
  node_updater["App updater<br/>[AppUpdater.kt]"]
  node_dex["DeX utilities"]
end

node_user(("Phone user"))

node_user -.->|"uses"| node_flutter
node_flutter -.->|"offers setup"| node_setup
node_flutter -.->|"offers catalog"| node_catalog
node_flutter -.->|"requests native actions"| node_platform
node_platform -.->|"invokes"| node_native
node_native -->|"uses"| node_runtime
node_native -->|"starts"| node_foreground
node_runtime -->|"uses"| node_profile
node_runtime -->|"installs profile"| node_linuxfiles
node_user -.->|"starts session"| node_foreground
node_foreground -->|"manages"| node_runtime
node_desktop -->|"starts desktop session"| node_runtime
node_desktop -->|"connects"| node_client
node_client -->|"binds and requests connection"| node_server
node_server -->|"starts native server"| node_surface
node_desktop -->|"displays desktop"| node_surface
node_desktop -->|"attaches input"| node_input
node_input -->|"handles gestures"| node_touch
node_input -->|"creates sender"| node_sender
node_sender -->|"injects events"| node_inputstub
node_touch -->|"maps coordinates"| node_renderdata
node_surface -->|"reads settings"| node_prefs
node_input -->|"reads and saves mode"| node_prefs
node_runtime -->|"sets up launching"| node_androidapps
node_androidapps -->|"integrates launchers"| node_desktoplinks
node_desktop -->|"uses clipboard sync"| node_clipboard
node_native -->|"uses updater"| node_updater
node_surface -->|"uses utilities"| node_dex

click node_flutter "https://github.com/piercingxx/fake-linux-phone/blob/main/app/lib/main.dart"
click node_setup "https://github.com/piercingxx/fake-linux-phone/tree/main/app/lib/screens/setup"
click node_catalog "https://github.com/piercingxx/fake-linux-phone/blob/main/app/lib/screens/apps/app_catalog_screen.dart"
click node_platform "https://github.com/piercingxx/fake-linux-phone/blob/main/app/lib/services/platform_bridge.dart"
click node_native "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/MainActivity.kt"
click node_runtime "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/LinuxRuntime.kt"
click node_profile "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/PiercingProfile.kt"
click node_linuxfiles "https://github.com/piercingxx/fake-linux-phone/tree/main/app/android/app/src/main/assets/fakelinux/dots"
click node_foreground "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/service/FakeLinuxService.kt"
click node_desktop "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt"
click node_server "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11ServerService.kt"
click node_client "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11ServiceClient.kt"
click node_input "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11InputController.kt"
click node_touch "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/input/TouchInputHandler.java"
click node_sender "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/input/InputEventSender.java"
click node_inputstub "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/input/InputStub.java"
click node_renderdata "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/input/RenderData.java"
click node_prefs "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/Prefs.java"
click node_androidapps "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/AndroidAppBridge.kt"
click node_desktoplinks "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/DesktopIntegration.kt"
click node_clipboard "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/ClipboardSync.kt"
click node_updater "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/AppUpdater.kt"
click node_dex "https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/utils/SamsungDexUtils.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_flutter,node_setup,node_catalog,node_platform,node_native,node_user toneBlue
class node_runtime,node_profile,node_linuxfiles toneAmber
class node_foreground,node_desktop,node_surface,node_server,node_client,node_input,node_touch,node_sender,node_inputstub,node_renderdata,node_prefs toneMint
class node_androidapps,node_desktoplinks,node_clipboard,node_updater,node_dex toneRose
```

## Components

### App and setup

- [Flutter interface](https://github.com/piercingxx/fake-linux-phone/blob/main/app/lib/main.dart): `app/lib/main.dart`
- [Setup screens](https://github.com/piercingxx/fake-linux-phone/tree/main/app/lib/screens/setup): `app/lib/screens/setup`
- [App catalog](https://github.com/piercingxx/fake-linux-phone/blob/main/app/lib/screens/apps/app_catalog_screen.dart): `app/lib/screens/apps/app_catalog_screen.dart`
- [Platform bridge](https://github.com/piercingxx/fake-linux-phone/blob/main/app/lib/services/platform_bridge.dart): `app/lib/services/platform_bridge.dart`
- [Android entry](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/MainActivity.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/MainActivity.kt`

### Linux environment

- [Linux runtime](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/LinuxRuntime.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/LinuxRuntime.kt`
- [Desktop profile](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/PiercingProfile.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/PiercingProfile.kt`
- [Bundled rice](https://github.com/piercingxx/fake-linux-phone/tree/main/app/android/app/src/main/assets/fakelinux/dots): `app/android/app/src/main/assets/fakelinux/dots`

### Desktop session

- [Session service](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/service/FakeLinuxService.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/service/FakeLinuxService.kt`
- [Desktop activity](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt`
- **X11 display**
- [X11 server](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11ServerService.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11ServerService.kt`
- [X11 client](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11ServiceClient.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11ServiceClient.kt`
- [Touch input](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11InputController.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11InputController.kt`
- [Gesture handling](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/input/TouchInputHandler.java): `app/android/app/src/main/java/com/termux/x11/input/TouchInputHandler.java`
- [Event sender](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/input/InputEventSender.java): `app/android/app/src/main/java/com/termux/x11/input/InputEventSender.java`
- [Input injection](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/input/InputStub.java): `app/android/app/src/main/java/com/termux/x11/input/InputStub.java`
- [Display mapping](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/input/RenderData.java): `app/android/app/src/main/java/com/termux/x11/input/RenderData.java`
- [X11 preferences](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/Prefs.java): `app/android/app/src/main/java/com/termux/x11/Prefs.java`

### Android integration

- [Android app bridge](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/AndroidAppBridge.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/AndroidAppBridge.kt`
- [Desktop integration](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/DesktopIntegration.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/DesktopIntegration.kt`
- [Clipboard sync](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/ClipboardSync.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/ClipboardSync.kt`
- [App updater](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/AppUpdater.kt): `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/AppUpdater.kt`
- [DeX utilities](https://github.com/piercingxx/fake-linux-phone/blob/main/app/android/app/src/main/java/com/termux/x11/utils/SamsungDexUtils.java): `app/android/app/src/main/java/com/termux/x11/utils/SamsungDexUtils.java`

### Other components

- **Phone user**

## Connections

- Phone user → Flutter interface: uses
- Flutter interface → Setup screens: offers setup
- Flutter interface → App catalog: offers catalog
- Flutter interface → Platform bridge: requests native actions
- Platform bridge → Android entry: invokes
- Android entry → Linux runtime: uses (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/MainActivity.kt`)
- Android entry → Session service: starts (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/MainActivity.kt`)
- Linux runtime → Desktop profile: uses (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/LinuxRuntime.kt`)
- Linux runtime → Bundled rice: installs profile (evidence: `README.md`)
- Phone user → Session service: starts session
- Session service → Linux runtime: manages (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/service/FakeLinuxService.kt`)
- Desktop activity → Linux runtime: starts desktop session (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt`)
- Desktop activity → X11 client: connects (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt`)
- X11 client → X11 server: binds and requests connection (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11ServiceClient.kt`)
- X11 server → X11 display: starts native server (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11ServerService.kt`)
- Desktop activity → X11 display: displays desktop (evidence: `README.md`)
- Desktop activity → Touch input: attaches input (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt`)
- Touch input → Gesture handling: handles gestures (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11InputController.kt`)
- Touch input → Event sender: creates sender (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11InputController.kt`)
- Event sender → Input injection: injects events (evidence: `app/android/app/src/main/java/com/termux/x11/input/InputEventSender.java`)
- Gesture handling → Display mapping: maps coordinates (evidence: `app/android/app/src/main/java/com/termux/x11/input/TouchInputHandler.java`)
- X11 display → X11 preferences: reads settings
- Touch input → X11 preferences: reads and saves mode (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/x11/X11InputController.kt`)
- Linux runtime → Android app bridge: sets up launching (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/LinuxRuntime.kt`)
- Android app bridge → Desktop integration: integrates launchers (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/runtime/DesktopIntegration.kt`)
- Desktop activity → Clipboard sync: uses clipboard sync (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/view/DesktopActivity.kt`)
- Android entry → App updater: uses updater (evidence: `app/android/app/src/main/kotlin/com/piercingxx/linux/MainActivity.kt`)
- X11 display → DeX utilities: uses utilities
