# littleyouran/littleyouran_cts_3 architecture

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

- Interactive diagram: https://gitdiagram.com/littleyouran/littleyouran_cts_3
- Repository: https://github.com/littleyouran/littleyouran_cts_3

## Overview

LittleYouran_CTS is a rooted Android CPU scheduler that applies scenario and per-app modes to device scheduling controls. The main path is startup, configuration and mode initialization, foreground-app detection, mode selection, then applying tuning to kernel/device interfaces; the WebSocket and Scene integrations provide separate control and status paths. Some wiring is inferred only where the sampled scheduler excerpt shows it; README-documented capabilities without sampled implementation are represented at their existing directory or module paths.

Main entry points: [`include/scheduler.hpp`](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/scheduler.hpp) (Scheduler), [`include/app_modes.hpp`](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/app_modes.hpp) (App mode service), [`include/WebSocket.hpp`](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/WebSocket.hpp) (WebSocket server), [`src/main.cpp`](https://github.com/littleyouran/littleyouran_cts_3/blob/main/src/main.cpp) (Runtime entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime control"]
  node_main["Runtime entry<br/>[main.cpp]"]
  node_schedule["Scheduler<br/>[scheduler.hpp]"]
  node_foreground["Foreground monitor"]
end

subgraph group_modes["Modes and configuration"]
  node_appmodes["App mode service<br/>[app_modes.hpp]"]
  node_config["Config loader<br/>[Config.hpp]"]
  node_deviceconfigs["SoC profiles"]
  node_appconfig["App mode files<br/>[app_modes.hpp]"]
  node_gamepackages["Game package list"]
end

subgraph group_tuning["Device tuning"]
  node_function["Extra optimizations<br/>[Function.hpp]"]
  node_schedulercontrols["CPU policy controls<br/>[scheduler.hpp]"]
  node_vtools["Power controls"]
  node_oppo["Oppo support<br/>[oppo.hpp]"]
  node_xiaomi["Xiaomi Feas<br/>[xiaomi.hpp]"]
end

subgraph group_interfaces["Control interfaces"]
  node_websocket["WebSocket server<br/>[WebSocket.hpp]"]
  node_webui["Web UI"]
  node_sceneadapter["Scene integration<br/>[app_modes.hpp]"]
end

node_android(("Android device"))
node_kernel[("Kernel interfaces")]
node_browser(("Web UI user"))
node_scene(("Scene toolbox"))

node_android -->|"starts runtime"| node_main
node_main -->|"creates"| node_schedule
node_schedule -->|"initializes"| node_appmodes
node_schedule -->|"loads settings"| node_config
node_config -->|"reads profile"| node_deviceconfigs
node_appmodes -->|"reads and writes"| node_appconfig
node_schedule -->|"starts monitor"| node_foreground
node_foreground -->|"reports app"| node_schedule
node_schedule -->|"selects mode"| node_appmodes
node_schedule -->|"applies state"| node_schedulercontrols
node_schedule -->|"applies extras"| node_function
node_schedulercontrols -->|"writes policy"| node_kernel
node_function -->|"writes tuning"| node_kernel
node_schedule -->|"initializes support"| node_oppo
node_schedule -->|"initializes support"| node_xiaomi
node_schedule -->|"updates package list"| node_gamepackages
node_schedule -->|"starts server"| node_websocket
node_websocket -->|"serves control and state"| node_browser
node_browser -->|"uses interface"| node_webui
node_webui -.->|"connects"| node_websocket
node_appmodes -->|"syncs rules"| node_sceneadapter
node_sceneadapter -.->|"provides mode rules"| node_scene
node_vtools -.->|"configures power"| node_kernel

click node_main "https://github.com/littleyouran/littleyouran_cts_3/blob/main/src/main.cpp"
click node_schedule "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/scheduler.hpp"
click node_foreground "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/ForegroundAppMonitor.hpp"
click node_appmodes "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/app_modes.hpp"
click node_config "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/Config.hpp"
click node_deviceconfigs "https://github.com/littleyouran/littleyouran_cts_3/tree/main/config"
click node_appconfig "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/app_modes.hpp"
click node_function "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/Function.hpp"
click node_schedulercontrols "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/scheduler.hpp"
click node_vtools "https://github.com/littleyouran/littleyouran_cts_3/tree/main/vtools"
click node_oppo "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/oppo.hpp"
click node_xiaomi "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/xiaomi.hpp"
click node_gamepackages "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/GamePackageFile.hpp"
click node_websocket "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/WebSocket.hpp"
click node_webui "https://github.com/littleyouran/littleyouran_cts_3/tree/main/webroot"
click node_sceneadapter "https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/app_modes.hpp"

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_schedule,node_foreground,node_browser toneBlue
class node_appmodes,node_config,node_deviceconfigs,node_appconfig,node_gamepackages,node_kernel toneAmber
class node_function,node_schedulercontrols,node_vtools,node_oppo,node_xiaomi toneMint
class node_websocket,node_webui,node_sceneadapter toneRose
class node_android,node_scene toneIndigo
```

## Components

### Runtime control

- [Runtime entry](https://github.com/littleyouran/littleyouran_cts_3/blob/main/src/main.cpp): `src/main.cpp`
- [Scheduler](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/scheduler.hpp): `include/scheduler.hpp`
- [Foreground monitor](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/ForegroundAppMonitor.hpp): `include/ForegroundAppMonitor.hpp`

### Modes and configuration

- [App mode service](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/app_modes.hpp): `include/app_modes.hpp`
- [Config loader](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/Config.hpp): `include/Config.hpp`
- [SoC profiles](https://github.com/littleyouran/littleyouran_cts_3/tree/main/config): `config`
- [App mode files](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/app_modes.hpp): `include/app_modes.hpp`
- [Game package list](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/GamePackageFile.hpp): `include/GamePackageFile.hpp`

### Device tuning

- [Extra optimizations](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/Function.hpp): `include/Function.hpp`
- [CPU policy controls](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/scheduler.hpp): `include/scheduler.hpp`
- [Power controls](https://github.com/littleyouran/littleyouran_cts_3/tree/main/vtools): `vtools`
- [Oppo support](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/oppo.hpp): `include/oppo.hpp`
- [Xiaomi Feas](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/xiaomi.hpp): `include/xiaomi.hpp`

### Control interfaces

- [WebSocket server](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/WebSocket.hpp): `include/WebSocket.hpp`
- [Web UI](https://github.com/littleyouran/littleyouran_cts_3/tree/main/webroot): `webroot`
- [Scene integration](https://github.com/littleyouran/littleyouran_cts_3/blob/main/include/app_modes.hpp): `include/app_modes.hpp`

### Other components

- **Android device**
- **Kernel interfaces**
- **Web UI user**
- **Scene toolbox**

## Connections

- Android device → Runtime entry: starts runtime
- Runtime entry → Scheduler: creates
- Scheduler → App mode service: initializes
- Scheduler → Config loader: loads settings
- Config loader → SoC profiles: reads profile
- App mode service → App mode files: reads and writes
- Scheduler → Foreground monitor: starts monitor
- Foreground monitor → Scheduler: reports app
- Scheduler → App mode service: selects mode
- Scheduler → CPU policy controls: applies state
- Scheduler → Extra optimizations: applies extras
- CPU policy controls → Kernel interfaces: writes policy
- Extra optimizations → Kernel interfaces: writes tuning
- Scheduler → Oppo support: initializes support
- Scheduler → Xiaomi Feas: initializes support
- Scheduler → Game package list: updates package list
- Scheduler → WebSocket server: starts server
- WebSocket server → Web UI user: serves control and state
- Web UI user → Web UI: uses interface
- Web UI → WebSocket server: connects
- App mode service → Scene integration: syncs rules
- Scene integration → Scene toolbox: provides mode rules
- Power controls → Kernel interfaces: configures power
