# canyouregret/android_framework_releated architecture

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

- Interactive diagram: https://gitdiagram.com/canyouregret/android_framework_releated
- Repository: https://github.com/canyouregret/android_framework_releated

## Overview

##### Project type and purpose
- This is not a runnable codebase but a collection of deep-dive articles (Markdown files) explaining Android Framework internals: Binder IPC, Activity launch flow, and Android boot sequence.

##### File structure
- Top-level files:
- “Binder机制详述.md” – Binder IPC mechanism
- “详述Activity启动流程.md” – Activity startup sequence
- “详述Android开机启动流程.md” – Android boot sequence
- README.md – project overview, motivation, learning path
- No code or build scripts—this is purely documentation.

##### README for additional insights
- Emphasizes layering (App → Framework → HAL → Kernel).
- Encourages using AOSP source references (android-13.0.0_r1) for accuracy.

## Diagram (Mermaid)

```mermaid
flowchart TD
    README["README.md"]:::document
    README -->|"describes"| ArticleBinder
    README -->|"describes"| ArticleActivity
    README -->|"describes"| ArticleBoot

    subgraph "Binder IPC Mechanism"
        ArticleBinder["Binder机制详述.md"]:::document
        ClientApp["Client App"]:::java
        BinderProxy["Binder Proxy"]:::java
        BinderDriver["Binder Driver (/dev/binder)"]:::kernel
        BinderStub["Binder Stub"]:::java
        ServiceImpl["Service Implementation"]:::java
        ClientApp -->|"transact()"| BinderProxy
        BinderProxy -->|"ioctl(BINDER_WRITE_READ)"| BinderDriver
        BinderDriver -->|"deliver data"| BinderStub
        BinderStub -->|"invoke onTransact()"| ServiceImpl
        ServiceImpl -->|"reply"| BinderStub
        BinderStub -->|"ioctl(BINDER_WRITE_READ)"| BinderDriver
        BinderDriver -->|"deliver data"| BinderProxy
        BinderProxy -->|"reply"| ClientApp
    end

    subgraph "Activity Launch Sequence"
        ArticleActivity["详述Activity启动流程.md"]:::document
        InputEvent["Input Event"]:::ui
        LauncherApp["Launcher App"]:::java
        AMS["ActivityManagerService"]:::java
        Zygote["Zygote Process"]:::native
        AppProcess["Application Process"]:::java
        WMS["WindowManagerService"]:::java
        SurfaceFlinger["SurfaceFlinger"]:::native
        DisplayDriver["Display Driver"]:::kernel
        InputEvent -->|"tap icon"| LauncherApp
        LauncherApp -->|"startActivity()"| AMS
        AMS -->|"fork()"| Zygote
        Zygote -->|"app process"| AppProcess
        AMS -->|"bindApplication"| AppProcess
        AppProcess -->|"onCreate()"| AMS
        AMS -->|"addWindow()"| WMS
        WMS -->|"compose"| SurfaceFlinger
        SurfaceFlinger -->|"render"| DisplayDriver
    end

    subgraph "Android Boot Sequence"
        ArticleBoot["详述Android开机启动流程.md"]:::document
        Bootloader["Bootloader"]:::firmware
        Kernel["Linux Kernel"]:::kernel
        InitProcess["init Process"]:::native
        InitRC["init.rc Scripts"]:::config
        ZygoteBoot["Zygote"]:::native
        SystemServer["SystemServer"]:::java
        Daemons["Daemons (vold, netd)"]:::native
        Bootloader -->|"load"| Kernel
        Kernel -->|"start"| InitProcess
        InitProcess -->|"parse"| InitRC
        InitRC -->|"spawn"| ZygoteBoot
        ZygoteBoot -->|"startService()"| SystemServer
        SystemServer -->|"launch"| Daemons
    end

    click ArticleBinder "https://github.com/canyouregret/android_framework_releated/blob/main/Binder机制详述.md"
    click ArticleActivity "https://github.com/canyouregret/android_framework_releated/blob/main/详述Activity启动流程.md"
    click ArticleBoot "https://github.com/canyouregret/android_framework_releated/blob/main/详述Android开机启动流程.md"
    click README "https://github.com/canyouregret/android_framework_releated/blob/main/README.md"

    classDef document fill:#f9f,stroke:#333,stroke-width:1px
    classDef java fill:#8ef,stroke:#333,stroke-width:1px
    classDef native fill:#fea,stroke:#333,stroke-width:1px
    classDef kernel fill:#faa,stroke:#333,stroke-width:1px
    classDef config fill:#ffd,stroke:#333,stroke-width:1px
    classDef ui fill:#cff,stroke:#333,stroke-width:1px
    classDef firmware fill:#fc9,stroke:#333,stroke-width:1px
```
