# mdp43140/ltecleanerfoss architecture

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

- Interactive diagram: https://gitdiagram.com/mdp43140/ltecleanerfoss
- Repository: https://github.com/mdp43140/ltecleanerfoss

## Overview

1. **Repository shape**
   - This is an **Android application** repo with one primary app module (`app`) plus a separate `baselineprofile` module for startup/performance optimization.
   - The app is a **local, on-device cleanup tool**: it scans the file system for safe-to-delete content and removes it, with user-controlled whitelist/blacklist rules.

2. **Top-level runtime architecture**
   - The app is built around standard Android components: an **Application** (`App.kt`), a **main Activity** (`MainActivity.kt`), several **Fragments**, a **background Service** (`CleanupService.kt`), a **BroadcastReceiver** (`BootReceiver.kt`), and a **background Worker** (`ScheduledWorker.kt`).
   - This suggests a split between **foreground UI** and **background cleanup/automation** paths.

3. **User-facing shell**
   - `MainActivity` is the host for the main screen and fragment navigation.
   - The main UI is divided into:
     - `MainFragment` for the primary cleanup workflow,
     - `WhitelistFragment` and `BlacklistFragment` for rule management,
     - `SettingsFragment` for preferences.
   - `BaseFragment` and `ListItemAdapter` provide shared UI behavior and list rendering.

4. **Cleanup engine**
   - `FileScanner.kt` is the core scanning subsystem: it likely traverses storage, classifies files/folders, and selects candidates for deletion.
   - `CleanupService.kt` is the execution boundary for actual cleanup work, isolating file deletion from the UI thread.
   - `CommonFunctions.kt` and `Constants.kt` hold shared logic and policy values used by scanning/cleanup paths.
   - The README indicates the app targets categories such as **logs, temporary files, caches, advertisement folders, empty folders, and clipboard clearing**.

5. **Rules and persistence**
   - The app persists user choices through `PreferenceRepository.kt` and the `SharedPreferencesExtension.kt` helper.
   - The whitelist/blacklist UI likely feeds directly into the scanner’s filtering logic, controlling what paths are excluded or targeted.
   - Preferences are defined in `res/xml/preferences.xml`, tying the settings screen to stored app state.

6. **Automation and background execution**
   - `ScheduledWorker.kt` is the periodic automation path for **daily cleanup**.
   - `BootReceiver.kt` indicates the app restores or re-arms scheduled behavior after device reboot.
   - Together these components form the app’s non-interactive maintenance flow: **boot/event trigger → worker/service → scanner → cleanup**.

7. **Emergency/auxiliary entry points**
   - `PanicResponderActivity.kt` is a separate activity used as an auxiliary runtime entry point, likely for a fast response action such as immediate cleanup or a shortcut-triggered action.
   - `res/xml/shortcuts.xml` confirms the app exposes at least one launcher shortcut path into core functionality.

8. **Data flow**
   - The main flow is: **user configures rules/settings in fragments → preferences are saved locally → cleanup is initiated manually or scheduled → scanner evaluates filesystem against rules → service performs deletions**.
   - There is no evidence of a server-side backend; the app appears to be **fully local/offline**, with no runtime cloud dependency.

9. **Platform/storage boundary**
   - Because the app cleans device storage, the main architectural boundary is between **Android UI/process lifecycle** and **filesystem access**.
   - Any cleanup action must pass through Android’s permission/runtime constraints, which is why scanning and deletion are encapsulated in dedicated background components.

10. **Resources and presentation**
   - The UI is classic Android XML-based layout (`activity_main`, fragment layouts, list item layout) with drawable icons and a dark-theme color overlay.
   - The large locale set under `res/values-*` shows the app is heavily internationalized; translation files are part of the product architecture, not just packaging.

11. **Performance layer**
   - The `baselineprofile` module contains startup benchmarks and baseline profile generation.
   - This affects app startup performance at install/run time, but not business logic; it is a build-time optimization layer.

12. **Build, quality, and release infrastructure**
   - The repo uses **Gradle Kotlin DSL**, Android lint, ProGuard rules, instrumented tests, and signing configuration.
   - GitHub Actions workflows cover Android builds, CodeQL analysis, image optimization, and GitHub Pages/Jekyll publishing.
   - Crowdin integration (`crowdin.yml`) indicates translation management is part of the release pipeline.

Main entry points: [`app/src/main/java/io/mdp43140/ltecleaner/fragment/MainFragment.kt`](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/MainFragment.kt) (Cleanup home), [`app/src/main/java/io/mdp43140/ltecleaner/CleanupService.kt`](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/CleanupService.kt) (Cleanup service), [`app/src/main/java/io/mdp43140/ltecleaner/MainActivity.kt`](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/MainActivity.kt) (Main screen), [`app/src/main/java/io/mdp43140/ltecleaner/fragment/WhitelistFragment.kt`](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/WhitelistFragment.kt) (Rule editors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App module"]
  node_app(("Application<br/>android app<br/>[App.kt]"))
  node_main_activity["Main screen<br/>activity host<br/>[MainActivity.kt]"]
  node_main_fragment["Cleanup home<br/>ui fragment<br/>[MainFragment.kt]"]
  node_rules_ui["Rule editors<br/>ui fragments"]
  node_settings_fragment["Settings<br/>ui fragment"]
  node_base_fragment["Base fragment<br/>ui base<br/>[BaseFragment.kt]"]
  node_list_adapter["List adapter<br/>ui adapter<br/>[ListItemAdapter.kt]"]
  node_scanner{{"File scanner<br/>scan engine<br/>[FileScanner.kt]"}}
  node_cleanup_service{{"Cleanup service<br/>background service<br/>[CleanupService.kt]"}}
  node_worker{{"Scheduled worker<br/>periodic worker<br/>[ScheduledWorker.kt]"}}
  node_boot_receiver["Boot receiver<br/>broadcast receiver<br/>[BootReceiver.kt]"]
  node_panic_activity(("Panic action<br/>aux activity"))
  node_prefs_repo[("Preferences<br/>local state")]
  node_shared_prefs["Prefs helper<br/>storage helper"]
  node_common["Shared logic<br/>utility core<br/>[CommonFunctions.kt]"]
end

subgraph group_profile["Baseline profile"]
  node_baseline_gen["Profile gen<br/>baseline profile"]
  node_startup_bench["Startup bench<br/>macrobenchmark"]
end

subgraph group_infra["Repo infra"]
  node_android_build["Android build<br/>gradle module<br/>[build.gradle.kts]"]
  node_repo_ci["Repo CI<br/>automation<br/>[android.yml]"]
end

node_app -->|"starts"| node_main_activity
node_main_activity -->|"navigates"| node_main_fragment
node_main_activity -->|"navigates"| node_rules_ui
node_main_activity -->|"navigates"| node_settings_fragment
node_main_fragment -->|"requests scan"| node_scanner
node_main_fragment -->|"starts cleanup"| node_cleanup_service
node_rules_ui -->|"updates rules"| node_prefs_repo
node_settings_fragment -->|"saves settings"| node_prefs_repo
node_prefs_repo -->|"uses"| node_shared_prefs
node_scanner -->|"applies policy"| node_common
node_cleanup_service -->|"drives"| node_scanner
node_cleanup_service -->|"reads rules"| node_prefs_repo
node_worker -->|"schedules"| node_cleanup_service
node_boot_receiver -->|"re-arms"| node_worker
node_panic_activity -->|"triggers"| node_cleanup_service
node_base_fragment -->|"shared by"| node_main_fragment
node_base_fragment -->|"shared by"| node_rules_ui
node_base_fragment -->|"shared by"| node_settings_fragment
node_main_fragment -->|"renders"| node_list_adapter
node_rules_ui -->|"renders"| node_list_adapter
node_baseline_gen -->|"uses"| node_startup_bench
node_android_build -->|"consumed by"| node_repo_ci
node_android_build -->|"includes"| node_baseline_gen

click node_app "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/App.kt"
click node_main_activity "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/MainActivity.kt"
click node_main_fragment "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/MainFragment.kt"
click node_rules_ui "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/WhitelistFragment.kt"
click node_settings_fragment "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/SettingsFragment.kt"
click node_base_fragment "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/BaseFragment.kt"
click node_list_adapter "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/ListItemAdapter.kt"
click node_scanner "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/FileScanner.kt"
click node_cleanup_service "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/CleanupService.kt"
click node_worker "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/ScheduledWorker.kt"
click node_boot_receiver "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/BootReceiver.kt"
click node_panic_activity "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/PanicResponderActivity.kt"
click node_prefs_repo "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/PreferenceRepository.kt"
click node_shared_prefs "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/util/SharedPreferencesExtension.kt"
click node_common "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/CommonFunctions.kt"
click node_baseline_gen "https://github.com/mdp43140/ltecleanerfoss/blob/main/baselineprofile/src/main/java/io/mdp43140/baselineprofile/BaselineProfileGenerator.kt"
click node_startup_bench "https://github.com/mdp43140/ltecleanerfoss/blob/main/baselineprofile/src/main/java/io/mdp43140/baselineprofile/StartupBenchmarks.kt"
click node_android_build "https://github.com/mdp43140/ltecleanerfoss/blob/main/app/build.gradle.kts"
click node_repo_ci "https://github.com/mdp43140/ltecleanerfoss/blob/main/.github/workflows/android.yml"

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_app,node_main_activity,node_main_fragment,node_rules_ui,node_settings_fragment,node_base_fragment,node_list_adapter,node_scanner,node_cleanup_service,node_worker,node_boot_receiver,node_panic_activity,node_prefs_repo,node_shared_prefs,node_common toneBlue
class node_baseline_gen,node_startup_bench toneAmber
class node_android_build,node_repo_ci toneMint
```

## Components

### App module

Primary Android application and runtime cleanup flow

- [Application](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/App.kt): android app · Process entrypoint and global app setup · `app/src/main/java/io/mdp43140/ltecleaner/App.kt`
- [Main screen](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/MainActivity.kt): activity host · Hosts the app shell and fragment navigation · `app/src/main/java/io/mdp43140/ltecleaner/MainActivity.kt`
- [Cleanup home](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/MainFragment.kt): ui fragment · Primary user workflow for scanning and cleanup · `app/src/main/java/io/mdp43140/ltecleaner/fragment/MainFragment.kt`
- [Rule editors](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/WhitelistFragment.kt): ui fragments · Whitelist and blacklist management screens · `app/src/main/java/io/mdp43140/ltecleaner/fragment/WhitelistFragment.kt`
- [Settings](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/SettingsFragment.kt): ui fragment · Preference and app configuration screen · `app/src/main/java/io/mdp43140/ltecleaner/fragment/SettingsFragment.kt`
- [Base fragment](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/BaseFragment.kt): ui base · Shared fragment behavior and lifecycle helpers · `app/src/main/java/io/mdp43140/ltecleaner/fragment/BaseFragment.kt`
- [List adapter](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/fragment/ListItemAdapter.kt): ui adapter · Renders rule and candidate lists · `app/src/main/java/io/mdp43140/ltecleaner/fragment/ListItemAdapter.kt`
- [File scanner](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/FileScanner.kt): scan engine · Traverses storage and classifies cleanup candidates · `app/src/main/java/io/mdp43140/ltecleaner/FileScanner.kt`
- [Cleanup service](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/CleanupService.kt): background service · Executes deletion work off the UI thread · `app/src/main/java/io/mdp43140/ltecleaner/CleanupService.kt`
- [Scheduled worker](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/ScheduledWorker.kt): periodic worker · Runs automated daily cleanup jobs · `app/src/main/java/io/mdp43140/ltecleaner/ScheduledWorker.kt`
- [Boot receiver](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/BootReceiver.kt): broadcast receiver · Re-arms scheduled automation after reboot · `app/src/main/java/io/mdp43140/ltecleaner/BootReceiver.kt`
- [Panic action](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/PanicResponderActivity.kt): aux activity · Alternate entrypoint for fast cleanup actions · `app/src/main/java/io/mdp43140/ltecleaner/PanicResponderActivity.kt`
- [Preferences](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/PreferenceRepository.kt): local state · Persists rules, settings, and cleanup policy · `app/src/main/java/io/mdp43140/ltecleaner/PreferenceRepository.kt`
- [Prefs helper](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/util/SharedPreferencesExtension.kt): storage helper · Convenience wrapper around shared preferences access · `app/src/main/java/io/mdp43140/ltecleaner/util/SharedPreferencesExtension.kt`
- [Shared logic](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/src/main/java/io/mdp43140/ltecleaner/CommonFunctions.kt): utility core · Common functions and constants used by cleanup paths · `app/src/main/java/io/mdp43140/ltecleaner/CommonFunctions.kt`

### Baseline profile

Startup performance optimization module

- [Profile gen](https://github.com/mdp43140/ltecleanerfoss/blob/main/baselineprofile/src/main/java/io/mdp43140/baselineprofile/BaselineProfileGenerator.kt): baseline profile · Generates startup baseline profiles · `baselineprofile/src/main/java/io/mdp43140/baselineprofile/BaselineProfileGenerator.kt`
- [Startup bench](https://github.com/mdp43140/ltecleanerfoss/blob/main/baselineprofile/src/main/java/io/mdp43140/baselineprofile/StartupBenchmarks.kt): macrobenchmark · Measures startup behavior for profile generation · `baselineprofile/src/main/java/io/mdp43140/baselineprofile/StartupBenchmarks.kt`

### Repo infra

Build, release, and project automation

- [Android build](https://github.com/mdp43140/ltecleanerfoss/blob/main/app/build.gradle.kts): gradle module · App module build, lint, and packaging configuration · `app/build.gradle.kts`
- [Repo CI](https://github.com/mdp43140/ltecleanerfoss/blob/main/.github/workflows/android.yml): automation · Build, analysis, image, and publishing workflows · `.github/workflows/android.yml`

## Connections

- Application → Main screen: starts · Application launches the main UI host
- Main screen → Cleanup home: navigates · Main screen hosts the cleanup workflow
- Main screen → Rule editors: navigates · Main screen switches to rule editors
- Main screen → Settings: navigates · Main screen opens settings
- Cleanup home → File scanner: requests scan · User-initiated cleanup begins with filesystem scanning
- Cleanup home → Cleanup service: starts cleanup · Foreground workflow hands off deletion work
- Rule editors → Preferences: updates rules · Whitelist and blacklist changes are persisted locally
- Settings → Preferences: saves settings · Preference screen writes configuration state
- Preferences → Prefs helper: uses · Repository wraps shared preference storage
- File scanner → Shared logic: applies policy · Scanner uses shared constants and helper logic
- Cleanup service → File scanner: drives · Service runs scan-and-delete execution
- Cleanup service → Preferences: reads rules · Cleanup honors stored user configuration
- Scheduled worker → Cleanup service: schedules · Periodic automation triggers cleanup execution
- Boot receiver → Scheduled worker: re-arms · Boot event restores scheduled maintenance
- Panic action → Cleanup service: triggers · Auxiliary entrypoint can invoke immediate cleanup
- Base fragment → Cleanup home: shared by · Core fragment base supports the main screen
- Base fragment → Rule editors: shared by · Core fragment base supports rule screens
- Base fragment → Settings: shared by · Core fragment base supports settings screen
- Cleanup home → List adapter: renders · Main UI uses reusable list rendering
- Rule editors → List adapter: renders · Rule editors use the same list adapter
- Profile gen → Startup bench: uses · Profile generation is driven by startup benchmarks
- Android build → Repo CI: consumed by · Module build is exercised by repository automation
- Android build → Profile gen: includes · Build configuration includes baseline profile module
