# casualsnek/waydroid_script architecture

> Architecture diagram of the GitHub repository casualsnek/waydroid_script, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/casualsnek/waydroid_script
- Repository: https://github.com/casualsnek/waydroid_script

## Overview

##### Project type and purpose
- This is a command-line tool (“Waydroid Extras Script”) written in Python. It automates the installation of Google Apps (GApps), Magisk, ARM translation libraries, DRM components, and various “hacks” into a WayDroid container on a Linux host.
- It is not a client-server or web application; rather it is an extensible CLI utility that orchestrates downloads, filesystem operations, container manipulation and native-binary invocations to augment WayDroid environments.

##### File structure
- Top level:
- main.py – entry point; parses commands/flags.
- bin/ – prebuilt native binaries (resetprop for each CPU architecture).
- stuff/ – individual feature-module implementations (gapps.py, magisk.py, nodataperm.py, etc.).
- tools/ – low-level helpers (container management, image download/extraction, logging).
- assets/ – documentation images only.
- requirements.txt & default.nix – dependency definitions.
- Pattern: layered, plugin-style architecture:
- CLI layer (main.py + argparse).
- Feature layer (stuff/*) – each feature plugs into main.py.
- Utility layer (tools/*) – encapsulates OS/WayDroid/container operations.
- Native binaries under bin/ for privileged actions.
- No database or web services; interactions are with:
- Host OS (shell commands, filesystem, lzip).
- WayDroid container runtime.
- Remote download sources (OpenGApps, Magisk releases, etc.).

##### Readme insights
- Describes interactive and non-interactive modes.
- Lists commands: install, uninstall, hack, certified.
- Mentions external prerequisites: lzip, WayDroid, sudo.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface"
        User["User / Terminal"]:::cli
    end

    subgraph "CLI Layer"
        main["CLI Parser & Orchestrator (main.py)"]:::cli
    end

    subgraph "Feature Modules"
        gapps["GApps Installer"]:::feature
        magisk["Magisk Installer"]:::feature
        androidid["Android ID Feature"]:::feature
        fdroidpriv["F-Droid Privileged Install"]:::feature
        generalf["General Utilities"]:::feature
        hidestatusbar["Status Bar Hider"]:::feature
        houdini["Houdini ARM Translation"]:::feature
        microg["MicroG Installer"]:::feature
        mitm["MITM Certificate Injection"]:::feature
        ndk["NDK Tools Installer"]:::feature
        nodataperm["No-Data-Permission Hack"]:::feature
        smartdock["SmartDock Tweak"]:::feature
        widevine["Widevine DRM Installer"]:::feature
    end

    subgraph "Utility Modules"
        container["Container Management APIs"]:::util
        images["Image Download & Extraction Helpers"]:::util
        helper["General Helper Functions"]:::util
        logger["Logging Utilities"]:::util
    end

    subgraph "Native Binaries"
        arm64["resetprop (ARM64-v8a)"]:::native
        armeabi["resetprop (armeabi-v7a)"]:::native
        x86["resetprop (x86)"]:::native
        x86_64["resetprop (x86_64)"]:::native
    end

    subgraph "Host & Container"
        host["Host OS & WayDroid Container"]:::infra
    end

    subgraph "External Services"
        downloads["External Download Endpoints"]:::external
    end

    subgraph "Documentation & Dependencies"
        docs["Documentation Assets"]:::external
        deps["Requirements.txt & default.nix"]:::external
    end

    User -->|"runs command"| main
    main -->|"dispatches to"| gapps
    main --> magisk
    main --> androidid
    main --> fdroidpriv
    main --> generalf
    main --> hidestatusbar
    main --> houdini
    main --> microg
    main --> mitm
    main --> ndk
    main --> nodataperm
    main --> smartdock
    main --> widevine

    gapps -->|"uses"| images
    magisk --> images
    androidid --> helper
    fdroidpriv --> helper
    generalf --> helper
    hidestatusbar --> helper
    houdini --> helper
    microg --> helper
    mitm --> helper
    ndk --> helper
    nodataperm --> helper
    smartdock --> helper
    widevine --> helper

    images -->|"manages container"| container
    helper --> container
    logger --> container

    container -->|"executes binaries"| host
    images --> host
    helper --> host
    logger --> host
    arm64 --> host
    armeabi --> host
    x86 --> host
    x86_64 --> host

    host -->|"downloads from"| downloads
    downloads --> images

    host -->|"reports status"| User

    deps --> main
    docs --> User

    click main "https://github.com/casualsnek/waydroid_script/blob/main/main.py"
    click gapps "https://github.com/casualsnek/waydroid_script/blob/main/stuff/gapps.py"
    click magisk "https://github.com/casualsnek/waydroid_script/blob/main/stuff/magisk.py"
    click androidid "https://github.com/casualsnek/waydroid_script/blob/main/stuff/android_id.py"
    click fdroidpriv "https://github.com/casualsnek/waydroid_script/blob/main/stuff/fdroidpriv.py"
    click generalf "https://github.com/casualsnek/waydroid_script/blob/main/stuff/general.py"
    click hidestatusbar "https://github.com/casualsnek/waydroid_script/blob/main/stuff/hidestatusbar.py"
    click houdini "https://github.com/casualsnek/waydroid_script/blob/main/stuff/houdini.py"
    click microg "https://github.com/casualsnek/waydroid_script/blob/main/stuff/microg.py"
    click mitm "https://github.com/casualsnek/waydroid_script/blob/main/stuff/mitm.py"
    click ndk "https://github.com/casualsnek/waydroid_script/blob/main/stuff/ndk.py"
    click nodataperm "https://github.com/casualsnek/waydroid_script/blob/main/stuff/nodataperm.py"
    click smartdock "https://github.com/casualsnek/waydroid_script/blob/main/stuff/smartdock.py"
    click widevine "https://github.com/casualsnek/waydroid_script/blob/main/stuff/widevine.py"
    click container "https://github.com/casualsnek/waydroid_script/blob/main/tools/container.py"
    click images "https://github.com/casualsnek/waydroid_script/blob/main/tools/images.py"
    click helper "https://github.com/casualsnek/waydroid_script/blob/main/tools/helper.py"
    click logger "https://github.com/casualsnek/waydroid_script/blob/main/tools/logger.py"
    click arm64 "https://github.com/casualsnek/waydroid_script/tree/main/bin/arm64-v8a/resetprop"
    click armeabi "https://github.com/casualsnek/waydroid_script/tree/main/bin/armeabi-v7a/resetprop"
    click x86 "https://github.com/casualsnek/waydroid_script/tree/main/bin/x86/resetprop"
    click x86_64 "https://github.com/casualsnek/waydroid_script/tree/main/bin/x86_64/resetprop"
    click docs "https://github.com/casualsnek/waydroid_script/tree/main/assets/img/README"
    click deps "https://github.com/casualsnek/waydroid_script/blob/main/requirements.txt"

    classDef cli fill:#D0E8FF,stroke:#0080FF,color:#000
    classDef feature fill:#E2F5D3,stroke:#33A02C,color:#000
    classDef util fill:#FFE8C4,stroke:#FF8000,color:#000
    classDef native fill:#F0E6FF,stroke:#8000FF,color:#000
    classDef infra fill:#F2F2F2,stroke:#666,color:#000
    classDef external fill:#EDEDED,stroke:#999,color:#000
```
