# naryuki/dextop architecture

> Architecture diagram of the GitHub repository naryuki/dextop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/naryuki/dextop
- Repository: https://github.com/naryuki/dextop

## Overview

Dextop turns an Android phone into a desktop workspace on a virtual display, with privileged system access handling display, window, and input operations. The documented main path is launching Dextop, creating/configuring a display session, then using its launcher and workspace layouts to place and interact with apps. Additional product branches cover multi-display and foldable displays, laptop input, diagnostics/recovery, and Android Auto companions. Source excerpts are partial; unsampled capabilities are represented only where the tree supports a relevant module, and uncertain wiring is omitted.

Main entry points: [`android/app/src/main/kotlin/moe/n4tsu/dextop/DesktopActivity.kt`](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DesktopActivity.kt) (Desktop activity), [`android/app/src/main/kotlin/moe/n4tsu/dextop/input/PrivilegedInputClient.kt`](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/input/PrivilegedInputClient.kt) (Input client), [`android/app/src/main/kotlin/moe/n4tsu/dextop/MirrorService.kt`](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/MirrorService.kt) (Display session), [`android/app/src/main/kotlin/moe/n4tsu/dextop/MainActivity.kt`](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/MainActivity.kt) (Main activity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_session["Desktop session"]
  node_main["Main activity<br/>[MainActivity.kt]"]
  node_launcher["Desktop launcher"]
  node_mirror["Display session<br/>[MirrorService.kt]"]
  node_desktop["Desktop activity<br/>[DesktopActivity.kt]"]
end

subgraph group_workspace["Workspace and displays"]
  node_catalog["App catalog<br/>[AppCatalog.kt]"]
  node_layout["Workspace layout"]
  node_topology["Display topology"]
  node_cover["Cover display"]
end

subgraph group_input["Input and privilege"]
  node_input_client["Input client"]
  node_input_service["Privileged input"]
  node_input_dispatch["Input dispatch<br/>[InputDispatcher.kt]"]
  node_privilege["Privilege runtime"]
end

subgraph group_companions["Companions and support"]
  node_recovery["Session recovery"]
  node_diagnostics["Device diagnostics"]
  node_relay["Car relay"]
  node_driving["Driving companion"]
  node_parking["Parking companion<br/>[CarDexActivity.kt]"]
end

node_user(("Phone user"))
node_external_display(("External display"))
node_auto_host(("Android Auto host"))

node_user -->|"opens"| node_main
node_main -->|"launches"| node_launcher
node_user -->|"selects apps"| node_launcher
node_launcher -->|"lists apps"| node_catalog
node_main -->|"starts session"| node_mirror
node_mirror -->|"presents display"| node_desktop
node_desktop -->|"positions windows"| node_layout
node_external_display -->|"provides display"| node_mirror
node_desktop -->|"manages displays"| node_topology
node_user -->|"switches display"| node_cover
node_desktop -->|"routes input"| node_input_client
node_input_client -->|"calls"| node_input_service
node_input_dispatch -->|"dispatches events"| node_input_client
node_input_client -.->|"uses access runtime"| node_privilege
node_user -->|"resumes session"| node_recovery
node_user -->|"requests report"| node_diagnostics
node_auto_host -->|"starts driving UI"| node_driving
node_auto_host -->|"opens parked UI"| node_parking
node_driving -->|"sends controls"| node_relay
node_parking -->|"sends controls"| node_relay
node_relay -->|"starts display session"| node_mirror

click node_main "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/MainActivity.kt"
click node_launcher "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DextopLauncherActivity.kt"
click node_mirror "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/MirrorService.kt"
click node_desktop "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DesktopActivity.kt"
click node_catalog "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/AppCatalog.kt"
click node_layout "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/WorkspaceLayoutEngine.kt"
click node_topology "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DisplayTopologyController.kt"
click node_cover "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/CoverDisplaySessionController.kt"
click node_input_client "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/input/PrivilegedInputClient.kt"
click node_input_service "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/input/PrivilegedInputService.kt"
click node_input_dispatch "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/InputDispatcher.kt"
click node_privilege "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/privilege/DistributionPrivilegeBootstrap.kt"
click node_recovery "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/HomeLaunchRecovery.kt"
click node_diagnostics "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DeviceDiagnostics.kt"
click node_relay "https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/CardexRelayService.kt"
click node_driving "https://github.com/naryuki/dextop/blob/main/android/cardex/src/main/kotlin/moe/n4tsu/cardex/DrivingCarAppService.kt"
click node_parking "https://github.com/naryuki/dextop/blob/main/android/cardex/src/main/kotlin/moe/n4tsu/cardex/CarDexActivity.kt"

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_main,node_launcher,node_mirror,node_desktop,node_user toneBlue
class node_catalog,node_layout,node_topology,node_cover toneAmber
class node_input_client,node_input_service,node_input_dispatch,node_privilege toneMint
class node_recovery,node_diagnostics,node_relay,node_driving,node_parking toneRose
class node_external_display,node_auto_host toneIndigo
```

## Components

### Desktop session

- [Main activity](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/MainActivity.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/MainActivity.kt`
- [Desktop launcher](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DextopLauncherActivity.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/DextopLauncherActivity.kt`
- [Display session](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/MirrorService.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/MirrorService.kt`
- [Desktop activity](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DesktopActivity.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/DesktopActivity.kt`

### Workspace and displays

- [App catalog](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/AppCatalog.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/AppCatalog.kt`
- [Workspace layout](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/WorkspaceLayoutEngine.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/WorkspaceLayoutEngine.kt`
- [Display topology](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DisplayTopologyController.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/DisplayTopologyController.kt`
- [Cover display](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/CoverDisplaySessionController.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/CoverDisplaySessionController.kt`

### Input and privilege

- [Input client](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/input/PrivilegedInputClient.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/input/PrivilegedInputClient.kt`
- [Privileged input](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/input/PrivilegedInputService.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/input/PrivilegedInputService.kt`
- [Input dispatch](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/InputDispatcher.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/InputDispatcher.kt`
- [Privilege runtime](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/privilege/DistributionPrivilegeBootstrap.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/privilege/DistributionPrivilegeBootstrap.kt`

### Companions and support

- [Session recovery](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/HomeLaunchRecovery.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/HomeLaunchRecovery.kt`
- [Device diagnostics](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/DeviceDiagnostics.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/DeviceDiagnostics.kt`
- [Car relay](https://github.com/naryuki/dextop/blob/main/android/app/src/main/kotlin/moe/n4tsu/dextop/CardexRelayService.kt): `android/app/src/main/kotlin/moe/n4tsu/dextop/CardexRelayService.kt`
- [Driving companion](https://github.com/naryuki/dextop/blob/main/android/cardex/src/main/kotlin/moe/n4tsu/cardex/DrivingCarAppService.kt): `android/cardex/src/main/kotlin/moe/n4tsu/cardex/DrivingCarAppService.kt`
- [Parking companion](https://github.com/naryuki/dextop/blob/main/android/cardex/src/main/kotlin/moe/n4tsu/cardex/CarDexActivity.kt): `android/cardex/src/main/kotlin/moe/n4tsu/cardex/CarDexActivity.kt`

### Other components

- **Phone user**
- **External display**
- **Android Auto host**

## Connections

- Phone user → Main activity: opens
- Main activity → Desktop launcher: launches
- Phone user → Desktop launcher: selects apps
- Desktop launcher → App catalog: lists apps
- Main activity → Display session: starts session
- Display session → Desktop activity: presents display
- Desktop activity → Workspace layout: positions windows
- External display → Display session: provides display
- Desktop activity → Display topology: manages displays
- Phone user → Cover display: switches display
- Desktop activity → Input client: routes input
- Input client → Privileged input: calls
- Input dispatch → Input client: dispatches events
- Input client → Privilege runtime: uses access runtime
- Phone user → Session recovery: resumes session
- Phone user → Device diagnostics: requests report
- Android Auto host → Driving companion: starts driving UI
- Android Auto host → Parking companion: opens parked UI
- Driving companion → Car relay: sends controls
- Parking companion → Car relay: sends controls
- Car relay → Display session: starts display session
