# f4dl0/keydroid architecture

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

- Interactive diagram: https://gitdiagram.com/f4dl0/keydroid
- Repository: https://github.com/f4dl0/keydroid

## Overview

#### Purpose and Runtime
KeyDroid is an Android application described as an Android keylogger with reverse-shell capability. It targets Android 6.0+ and is built as a Gradle Android project. Its runtime is primarily Android framework services rather than a conventional foreground web or desktop application.

Relevant paths: `app/app/build.gradle`, `app/app/src/main/AndroidManifest.xml`, `app/settings.gradle`

#### Application Entry and Registration
Android component registration is controlled by the manifest. The project’s visible UI and keyboard/input-method integration are backed by Java components and XML declarations. The input method must be enabled/selected through Android’s system keyboard settings before it can receive text-entry events.

Relevant paths: `app/app/src/main/AndroidManifest.xml`, `app/app/src/main/res/xml/method.xml`, `app/app/src/main/java/com/keydroid/SimpleIME.java`

#### Input Capture Stage
`SimpleIME` is the central input-method component. It implements the custom keyboard experience, receives key interactions through Android’s IME lifecycle, and connects input events to the application’s logging/control behavior. Keyboard layouts and key appearance are resource-driven rather than hard-coded entirely in Java.

Relevant paths: `app/app/src/main/java/com/keydroid/SimpleIME.java`, `app/app/src/main/res/layout/keyboard.xml`, `app/app/src/main/res/xml/qwerty.xml`

#### Background Execution and Command Channel
`BackService` is the long-running background-service boundary. Based on the repository description, it is responsible for behavior outside the keyboard UI, including the reverse-shell/control capability and likely delivery or handling of captured information. This creates the principal separation between Android UI/IME execution and background network or command processing.

Relevant paths: `app/app/src/main/java/com/keydroid/BackService.java`, `app/app/src/main/AndroidManifest.xml`

#### User Interface and Keyboard Presentation
The application provides an activity layout plus custom keyboard and preview resources. These resources define the user-facing configuration/presentation layer and the IME’s rendered keyboard surfaces. Device-density and large-screen resource variants support Android display adaptation.

Relevant paths: `app/app/src/main/res/layout/activity_main.xml`, `app/app/src/main/res/layout/keyback.xml`, `app/app/src/main/res/layout/preview.xml`

#### Data/Control Flow
The primary flow is: Android activates the registered input method → `SimpleIME` renders XML-defined keyboard layouts and receives input → captured input/control events are passed into background behavior → `BackService` handles non-UI processing and external communication. Android permissions, component declarations, and IME metadata are the critical platform boundaries governing whether each stage can run.

Relevant paths: `app/app/src/main/java/com/keydroid/SimpleIME.java`, `app/app/src/main/java/com/keydroid/BackService.java`, `app/app/src/main/res/xml/method.xml`

#### Build, Packaging, and External Dependencies
The Android module is under `app/app`; Gradle wrapper files support reproducible local builds. Bundled JARs include JavaMail and activation libraries, indicating SMTP/email-related capability may be part of external data transfer or notification behavior. A signing keystore is present for APK signing.

Relevant paths: `app/app/libs/mail.jar`, `app/app/libs/activation.jar`, `app/key.keystore`

Main entry points: [`app/app/src/main/java/com/keydroid/SimpleIME.java`](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/java/com/keydroid/SimpleIME.java) (SimpleIME), [`app/app/src/main/AndroidManifest.xml`](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/AndroidManifest.xml) (Component manifest), [`app/app/build.gradle`](https://github.com/f4dl0/keydroid/blob/master/app/app/build.gradle) (Android Gradle module), [`app/app/src/main/java/com/keydroid/BackService.java`](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/java/com/keydroid/BackService.java) (BackService)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build & packaging"]
  node_gradle["Android Gradle module<br/>build module<br/>[build.gradle]"]
  node_keystore["APK signing key<br/>keystore<br/>[key.keystore]"]
  node_mail_lib["JavaMail library<br/>bundled mail dependency<br/>[mail.jar]"]
  node_activation_lib["Activation library<br/>bundled dependency<br/>[activation.jar]"]
end

subgraph group_android["Android runtime"]
  node_manifest["Component manifest<br/>Android manifest"]
  node_android_os{{"Android system<br/>platform runtime"}}
  node_ime_settings["Keyboard settings<br/>system selection"]
  node_ime_metadata["IME metadata<br/>input-method XML<br/>[method.xml]"]
  node_simple_ime["SimpleIME<br/>input method service<br/>[SimpleIME.java]"]
  node_keyboard_layout["Keyboard layout<br/>IME layout resource<br/>[keyboard.xml]"]
  node_key_map["QWERTY key map<br/>IME key definitions<br/>[qwerty.xml]"]
  node_app_ui["Application UI<br/>activity presentation<br/>[activity_main.xml]"]
  node_back_service["BackService<br/>background service<br/>[BackService.java]"]
end

subgraph group_remote["External channel"]
  node_external_channel{{"Remote control / delivery<br/>external endpoint"}}
end

node_gradle -->|"packages"| node_manifest
node_gradle -->|"bundles"| node_mail_lib
node_gradle -->|"bundles"| node_activation_lib
node_keystore -->|"signs"| node_gradle
node_manifest -->|"registers"| node_simple_ime
node_manifest -->|"registers"| node_back_service
node_manifest -->|"references"| node_ime_metadata
node_android_os -->|"reads declarations"| node_manifest
node_ime_settings -->|"selects IME"| node_android_os
node_android_os -->|"activates"| node_simple_ime
node_simple_ime -->|"renders"| node_keyboard_layout
node_simple_ime -->|"uses"| node_key_map
node_simple_ime -->|"passes input / control"| node_back_service
node_app_ui -.->|"presents configuration"| node_simple_ime
node_back_service -.->|"may use delivery support"| node_mail_lib
node_back_service -->|"communicates"| node_external_channel

click node_gradle "https://github.com/f4dl0/keydroid/blob/master/app/app/build.gradle"
click node_keystore "https://github.com/f4dl0/keydroid/blob/master/app/key.keystore"
click node_manifest "https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/AndroidManifest.xml"
click node_ime_metadata "https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/res/xml/method.xml"
click node_simple_ime "https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/java/com/keydroid/SimpleIME.java"
click node_keyboard_layout "https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/res/layout/keyboard.xml"
click node_key_map "https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/res/xml/qwerty.xml"
click node_app_ui "https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/res/layout/activity_main.xml"
click node_back_service "https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/java/com/keydroid/BackService.java"
click node_mail_lib "https://github.com/f4dl0/keydroid/blob/master/app/app/libs/mail.jar"
click node_activation_lib "https://github.com/f4dl0/keydroid/blob/master/app/app/libs/activation.jar"

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_gradle,node_keystore,node_mail_lib,node_activation_lib toneBlue
class node_manifest,node_android_os,node_ime_settings,node_ime_metadata,node_simple_ime,node_keyboard_layout,node_key_map,node_app_ui,node_back_service toneAmber
class node_external_channel toneMint
```

## Components

### Build & packaging

- [Android Gradle module](https://github.com/f4dl0/keydroid/blob/master/app/app/build.gradle): build module · `app/app/build.gradle`
- [APK signing key](https://github.com/f4dl0/keydroid/blob/master/app/key.keystore): keystore · `app/key.keystore`
- [JavaMail library](https://github.com/f4dl0/keydroid/blob/master/app/app/libs/mail.jar): bundled mail dependency · `app/app/libs/mail.jar`
- [Activation library](https://github.com/f4dl0/keydroid/blob/master/app/app/libs/activation.jar): bundled dependency · `app/app/libs/activation.jar`

### Android runtime

- [Component manifest](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/AndroidManifest.xml): Android manifest · Declares permissions, activity, IME, and background service. · `app/app/src/main/AndroidManifest.xml`
- **Android system**: platform runtime · Activates registered components subject to system settings and permissions.
- **Keyboard settings**: system selection · The user must enable and select the custom input method.
- [IME metadata](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/res/xml/method.xml): input-method XML · `app/app/src/main/res/xml/method.xml`
- [SimpleIME](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/java/com/keydroid/SimpleIME.java): input method service · Receives keyboard events and links capture to background behavior. · `app/app/src/main/java/com/keydroid/SimpleIME.java`
- [Keyboard layout](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/res/layout/keyboard.xml): IME layout resource · `app/app/src/main/res/layout/keyboard.xml`
- [QWERTY key map](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/res/xml/qwerty.xml): IME key definitions · `app/app/src/main/res/xml/qwerty.xml`
- [Application UI](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/res/layout/activity_main.xml): activity presentation · Configuration and keyboard presentation layouts. · `app/app/src/main/res/layout/activity_main.xml`
- [BackService](https://github.com/f4dl0/keydroid/blob/master/app/app/src/main/java/com/keydroid/BackService.java): background service · Handles non-UI processing, control, and external communication. · `app/app/src/main/java/com/keydroid/BackService.java`

### External channel

- **Remote control / delivery**: external endpoint · Receives service communications or commands.

## Connections

- Android Gradle module → Component manifest: packages
- Android Gradle module → JavaMail library: bundles
- Android Gradle module → Activation library: bundles
- APK signing key → Android Gradle module: signs
- Component manifest → SimpleIME: registers
- Component manifest → BackService: registers
- Component manifest → IME metadata: references
- Android system → Component manifest: reads declarations
- Keyboard settings → Android system: selects IME
- Android system → SimpleIME: activates
- SimpleIME → Keyboard layout: renders
- SimpleIME → QWERTY key map: uses
- SimpleIME → BackService: passes input / control
- Application UI → SimpleIME: presents configuration
- BackService → JavaMail library: may use delivery support
- BackService → Remote control / delivery: communicates
