# pepsimaxin/aosp_launcher3_gradle architecture

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

- Interactive diagram: https://gitdiagram.com/pepsimaxin/aosp_launcher3_gradle
- Repository: https://github.com/pepsimaxin/aosp_launcher3_gradle

## Overview

##### Project type and purpose
- This is AOSP’s Launcher3, an Android home-screen/recents application.
- The quickstep module (under quickstep/src/com/android/quickstep/) implements gesture-based navigation (swipe-up, back, overview) and hand-off to the Recents UI and animation pipeline.

##### File-structure analysis (quickstep module)
- Top-level in quickstep/src/com/android/quickstep/:
- InputConsumer.java + many concrete *InputConsumer classes (e.g., OverviewInputConsumer, StatusBarInputConsumer)
- Swipe handlers: AbsSwipeUpHandler.java, LauncherSwipeHandlerV2.java, FallbackSwipeHandler.java
- TouchInteractionService.java – entry point for raw touch events from the system
- GestureState.java – state machine definition
- OrientationTouchTransformer.java – transforms raw touch coords by display rotation
- Controllers/Managers: QuickstepProcessInitializer.kt, SystemUiProxy.java, TaskAnimationManager.java
- Recents orchestration: RecentsActivity.java, RecentsAnimationController.java, RecentsModel.java, RemoteAnimationTargets.java

##### Key insights from README
- AOSP-based, pure upstream code
- Built with Gradle, targets Android 14/15
- No custom modifications—follow AOSP patterns

##### Designing the gesture-handling flowchart
1. TouchInteractionService (TIS) – receives raw MotionEvents from WindowManager
2. InputConsumer chain – one or more consumers registered to TIS (OverviewInputConsumer, StatusBarInputConsumer, etc.)
3. SwipeUpHandler – selects between LauncherSwipeHandlerV2 or FallbackSwipeHandler via AbsSwipeUpHandler
4. GestureState machine – tracks gesture progress (BEGIN, DRAGGING, RELEASING, CANCELLED)
5. QuickstepTransitionManager (via SystemUiProxy) – decides action: go Home, open Recents, launch App
6. RecentsAnimationController – kicks off remote animation with System UI
7. RecentsActivity / Overview UI – final rendering of recents screen

b. Relationships & data-flow
- Decision diamond: “gesture distance & velocity thresholds?”

c. Architectural patterns & design principles
- Chain of Responsibility for InputConsumers
- State pattern for gesture progression (GestureState)
- MVC: RecentsModel supplies data → RecentsActivity (View) uses controllers
- Remote animation via Binder/IPC (RemoteAnimationTargets, RemoteRunnable)

d. Technologies & frameworks
- Java / Kotlin on Android SDK
- Android input pipeline (MotionEvent, InputChannel)
- SurfaceTransaction (in RecentsAnimationController)
- Binder IPC to SystemUI (via SystemUiProxy)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Path
    WM["WindowManager"]:::external
    TIS["TouchInteractionService"]:::input
    InputConsumerBase["InputConsumer"]:::input
    subgraph "Concrete InputConsumers"
        OIC["OverviewInputConsumer"]:::input
        SIC["StatusBarInputConsumer"]:::input
    end

    WM -->|"MotionEvent"| TIS
    TIS -->|"dispatchTouchEvent"| InputConsumerBase
    InputConsumerBase --> OIC
    InputConsumerBase --> SIC

    %% Handlers
    ABS["AbsSwipeUpHandler"]:::input
    DEC{"gesture<br/>distance & velocity<br/>thresholds?"}:::input
    LSH["LauncherSwipeHandlerV2"]:::input
    FSH["FallbackSwipeHandler"]:::input

    OIC -->|"onTouch"| ABS
    SIC -->|"onTouch"| ABS
    ABS -->|"handleTouch()"| DEC
    DEC -->|Yes| LSH
    DEC -->|No| FSH

    %% Business Logic
    GS["GestureState"]:::logic
    QTM["QuickstepTransitionManager"]:::logic
    SIP["SystemUiProxy"]:::ipc

    LSH -->|"onSwipe()"| GS
    FSH -->|"onSwipe()"| GS
    GS -->|"onRelease"| QTM
    QTM -->|"transition()"| SIP

    %% Animation / IPC
    RAC["RecentsAnimationController"]:::ipc
    RAT["RemoteAnimationTargets"]:::ipc
    TAM["TaskAnimationManager"]:::ipc

    SIP -->|"startAnimation()"| RAC
    RAC -->|"registerTargets"| RAT
    RAT -->|"manageTasks"| TAM

    %% UI Rendering
    RM["RecentsModel"]:::ui
    RA["RecentsActivity"]:::ui

    RAC -->|"animationCallback"| RA
    RM --> RA

    %% Click Events
    click TIS "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/TouchInteractionService.java"
    click InputConsumerBase "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/InputConsumer.java"
    click OIC "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java"
    click SIC "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/inputconsumers/StatusBarInputConsumer.java"
    click ABS "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java"
    click LSH "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java"
    click FSH "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java"
    click GS "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/GestureState.java"
    click QTM "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java"
    click SIP "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/SystemUiProxy.java"
    click TAM "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/TaskAnimationManager.java"
    click RAC "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/RecentsAnimationController.java"
    click RM "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/RecentsModel.java"
    click RA "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/RecentsActivity.java"
    click RAT "https://github.com/pepsimaxin/aosp_launcher3_gradle/blob/android-14.0.0_r28/quickstep/src/com/android/quickstep/RemoteAnimationTargets.java"

    %% Styles
    classDef input fill:#cce5ff,stroke:#004085;
    classDef logic fill:#d4edda,stroke:#155724;
    classDef ipc fill:#fff3cd,stroke:#856404;
    classDef ui fill:#f5c6cb,stroke:#721c24;
    classDef external fill:#e2e3e5,stroke:#6c757d;
```
