ShizuStore

OptiDroid

androidexpert35

1.7.0 · GitHub

Download APK
Miscellaneous Android 8.0+ 2 months ago Apache-2.0
176 ShizuStore
12.1k GitHub
115 Stars
14 MB Size

More about this app

GUI for Android's builtin `dex2oat` utility, allowing DEX code of installed apps to be re-optimized

OptiDroid App Icon

OptiDroid

Supercharge your Android device performance — one tap at a time.

Features • Screenshots • How It Works • Getting Started • Architecture • Tech Stack • Building • Contributing • License

Kotlin Compose Min SDK Target SDK Architecture License

Get it on Google Play


✨ What is OptiDroid?

OptiDroid is a modern Android app that optimizes the ART (Android Runtime) compilation of every installed app on your device. It leverages dex2oat — Android's ahead-of-time compiler — to re-compile apps with aggressive optimization profiles, resulting in faster app launches, smoother scrolling, and better overall performance.

Think of it as defragmenting your phone's app layer — apps run native-speed code instead of interpreted bytecode.


🚀 Features

🔍 Smart Analysis

  • Pre-scan all installed apps to determine which need optimization
  • Intelligent skip logic — already-optimized and recently compiled apps are skipped
  • Detailed per-app compilation status including compiler filter, timestamps, and OAT file presence

⚡ One-Tap Optimization

  • Batch optimization of all apps that need it
  • Real-time progress tracking with per-app status
  • Live activity feed showing optimization logs as they happen
  • Background execution via WorkManager with foreground notification

🎛️ Configurable Optimization Modes

Mode Description Best For
speed-profile Profile-guided compilation — optimizes hot code paths Daily use, balanced
speed (Full) Aggressively compiles everything ahead-of-time Maximum performance

🔐 Privileged Access via Shizuku

  • No root required — uses Shizuku for privileged shell access
  • Guided setup wizard walks you through enabling Shizuku step by step
  • Automatic permission handling with clear status indicators

🎨 Beautiful Material 3 UI

  • Material Design 3 Expressive with dynamic color theming
  • Smooth 60fps animations on all state transitions
  • Dark mode support out of the box
  • Localization ready (English & Italian)

📱 Screenshots

Coming soon — PRs welcome!


🧠 How It Works

┌─────────────────────────────────────────────────────────┐
│  1. Setup    │  Enable Shizuku for privileged access     │
├──────────────┼───────────────────────────────────────────┤
│  2. Analyze  │  Scan all apps → find what needs work     │
├──────────────┼───────────────────────────────────────────┤
│  3. Optimize │  Run `cmd package compile` on each app    │
├──────────────┼───────────────────────────────────────────┤
│  4. Enjoy    │  Faster launches & smoother performance   │
└─────────────────────────────────────────────────────────┘

Under the hood, OptiDroid:

  1. Connects to a privileged shell via Shizuku (or wireless ADB)
  2. Analyzes every installed package's compilation status using dumpsys package and OAT file metadata
  3. Filters out apps that are already optimized, system apps, or recently compiled
  4. Executes cmd package compile -m <mode> -f <package> for each app that needs optimization
  5. Streams real-time progress and logs back to the UI via StateFlow

🏁 Getting Started

Prerequisites

Requirement Details
Android Device Android 8.0+ (API 26)
Shizuku Install from Google Play or GitHub
ADB (for Shizuku) One-time setup via adb shell sh /sdcard/Android/data/moe.shizuku.privileged.api/start.sh

Quick Start

  1. Install Shizuku and start the Shizuku service
  2. Install OptiDroid (build from source or grab a release)
  3. Grant permission — OptiDroid will guide you through the Shizuku setup
  4. Tap Analyze to scan your apps
  5. Tap Optimize and watch the magic happen ✨

🏗️ Architecture

OptiDroid follows Clean Architecture with MVVM + Unidirectional Data Flow (UDF).

┌──────────────────────────────────────────────────────────┐
│                    Presentation Layer                      │
│  ┌──────────────┐  ┌───────────┐  ┌───────────────────┐  │
│  │  Composables  │←─│ ViewModels│←─│ UiModels/UiState  │  │
│  │  (Screens)    │──│ (State +  │  │ (Immutable)       │  │
│  │               │  │  Events)  │  │                   │  │
│  └──────────────┘  └─────┬─────┘  └───────────────────┘  │
│                          │                                 │
├──────────────────────────┼─────────────────────────────────┤
│                    Domain Layer (Pure Kotlin)               │
│  ┌──────────────┐  ┌─────┴─────┐  ┌───────────────────┐  │
│  │  Use Cases    │  │Repository │  │  Domain Models     │  │
│  │  (invoke())   │  │Interfaces │  │  (Entities)        │  │
│  └──────────────┘  └─────┬─────┘  └───────────────────┘  │
│                          │                                 │
├──────────────────────────┼─────────────────────────────────┤
│                    Data Layer                               │
│  ┌──────────────┐  ┌─────┴─────┐  ┌───────────────────┐  │
│  │  Repository   │  │   Data    │  │  Shizuku / ADB    │  │
│  │  Impls        │  │  Sources  │  │  Shell Clients    │  │
│  └──────────────┘  └───────────┘  └───────────────────┘  │
└──────────────────────────────────────────────────────────┘

Project Structure

com.tony.appbooster/
├── 📂 data/              # Repository implementations, shell clients
│   ├── client/           # ADB & Shizuku shell client implementations
│   ├── repository/       # Concrete repository classes
│   └── scheduler/        # WorkManager schedulers
├── 📂 domain/            # Pure Kotlin — zero Android dependencies
│   ├── client/           # Shell client interfaces
│   ├── model/            # Domain entities (Progress, Analysis, Config)
│   ├── repository/       # Repository contracts
│   ├── scheduler/        # Work scheduler interfaces
│   └── usecase/          # Business logic (Analyze, Optimize, Connect)
├── 📂 presentation/      # UI layer (Compose + ViewModels)
│   ├── navigation/       # Navigation graph & Screen definitions
│   ├── screen/           # Composable screens (Dashboard, Settings, Shizuku)
│   ├── ui/               # Theme, components, design system
│   ├── viewmodel/        # ViewModels + UiModels
│   └── worker/           # WorkManager workers for background optimization
└── 📂 di/                # Hilt dependency injection modules

🛠️ Tech Stack

Category Technology
Language Kotlin 2.3
UI Framework Jetpack Compose + Material 3 Expressive
Architecture MVVM + Clean Architecture + UDF
DI Hilt (constructor injection)
Async Coroutines + StateFlow / SharedFlow
Navigation Navigation Compose
Background Work WorkManager with foreground service
Storage DataStore Preferences
Shell Access Shizuku API / Dadb (wireless ADB)
Testing JUnit 4, MockK, Turbine
Build System Gradle with Version Catalog

🔨 Building

Prerequisites

  • Android Studio Ladybug (2024.3+) or newer
  • JDK 17+
  • Android SDK 36

Build & Run

# Clone the repository
git clone https://github.com/yourusername/OptiDroid.git
cd OptiDroid

# Build debug APK
./gradlew assembleDebug

# Install on connected device
./gradlew installDebug

# Run unit tests
./gradlew runUnitTests

# Run all tests (requires connected device)
./gradlew runAllTests

Build Variants

Variant Description
debug Development build with debugging enabled
release Optimized build (ProGuard rules included)

GitHub Actions CI

The repository includes a GitHub Actions workflow at .github/workflows/android-ci.yml with three jobs:

Job Trigger What it does
Unit tests Every push & PR Runs ./gradlew runUnitTests (the existing Gradle task)
Signed release build Push to master only, after tests pass Builds signed APK + AAB
Publish GitHub Release After signed build succeeds Creates a GitHub Release with the merged PR body as changelog and attaches the APK & AAB

The release tag is derived automatically from versionName and versionCode in app/build.gradle.kts (e.g. v1.0-1).

Changelog: When you merge a PR into master, the CI extracts the PR description and uses it as the release notes. If no matching PR is found (e.g. a direct push), it falls back to the last 10 commit messages.

Configure these repository secrets:

Secret Purpose
GH_RELEASE_KEYSTORE_BASE64 Base64-encoded contents of the release keystore file
GH_RELEASE_KEY_ALIAS Alias of the release key inside the keystore
GH_RELEASE_KEY_PASSWORD Password for the selected key alias
GH_RELEASE_STORE_PASSWORD Password for the keystore itself

All four secrets are required for the release & publish jobs. Unit tests still run on every push and PR regardless of secrets.


🧪 Testing

OptiDroid uses a modern testing stack with clear naming conventions:

@Test
fun `given apps need optimization when optimize invoked then returns success`()
# Unit tests only (no device needed)
./gradlew runUnitTests

# Instrumented tests (requires device/emulator)
./gradlew runInstrumentedTests

# Full suite
./gradlew runAllTests

Reports are generated at:

  • Unit tests → app/build/reports/tests/testDebugUnitTest/index.html
  • Instrumented → app/build/reports/androidTests/connected/debug/index.html

🤝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

🤖 AI Coding Guidelines — Use Our Copilot Instructions

This project ships a .github/copilot-instructions.md file tracked in Git.

If you use GitHub Copilot, Cursor, JetBrains AI, or any AI-powered coding assistant, point it to this file. It contains the full architecture rules, documentation standards, Compose patterns, and forbidden practices that keep the codebase clean and consistent.

How to use it:

Tool Setup
GitHub Copilot Automatically picked up from .github/copilot-instructions.md
JetBrains AI Add as a custom prompt / instruction file in Settings → AI Assistant
Cursor Add to .cursorrules or reference in project settings
Other AI tools Copy the contents into your assistant's system prompt

Following these instructions ensures every contribution matches the project's Clean Architecture, MVVM + UDF patterns, KDoc standards, and Material 3 Expressive UI conventions — whether the code is written by a human or generated by AI.

Guidelines

  • Follow the AI coding guidelines for architecture, style, and documentation standards
  • Write KDoc for all public APIs
  • Include unit tests for new use cases and ViewModels
  • Use Material 3 Expressive components with proper animations
  • Keep the domain layer free of Android dependencies

📄 License

Copyright 2025 Tony

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

🙏 Acknowledgments


Made with ❤️ and Kotlin

Close

How Shizuku is used

Can re-optimize installed apps and scan their status via `cmd package compile`, `dumpsys` and `pm` through Shizuku.

This is an AI-assisted analysis of Shizuku-related usages in the app's public source code. It is best effort, so it may not catch every single usage.

How this app uses Shizuku

OptiDroid uses Shizuku to run privileged shell commands for inspecting and re-optimizing the DEX code of installed apps.

  • Recompile installed apps: the user can optimize one or many installed apps at once, applied with the cmd package compile -m mode -f package shell command through Shizuku using the mode chosen in settings.
  • Analyze optimization status: the user can scan which apps need optimization and view their current compiler filter, checked with the dumpsys package dexopt, dumpsys package, cmd package compile --check and OAT file ls shell commands through Shizuku.
  • List installed apps: the user can load the list of apps available for analysis and optimization, queried with the pm list packages shell commands through Shizuku.

Android APIs or commands used

  • pm list packages
  • pm list packages -3
  • cmd package compile -m
  • cmd package compile --check
  • dumpsys package dexopt
  • dumpsys package
  • ls

Notable details

The app excludes itself from the optimization list to prevent a self crash, so all other installed packages can be scanned and compiled but its own package cannot.

Close

Changelog

What's new for version 1.7.0

V1.7.0

  • Improve layout of activity card
  • Improved settings screen code
Close

Permissions

9 permissions requested

  • android.permission.FOREGROUND_SERVICE
  • android.permission.FOREGROUND_SERVICE_DATA_SYNC
  • android.permission.POST_NOTIFICATIONS
  • android.permission.INTERNET
  • android.permission.ACCESS_NETWORK_STATE
  • android.permission.WAKE_LOCK
  • android.permission.RECEIVE_BOOT_COMPLETED
  • com.tony.appbooster.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
  • moe.shizuku.manager.permission.API_V23
Close