# UltraOpt --- Native Optimization Module (Magisk)

UltraOpt is a Magisk module focused on **native (C++) logic** and
**safe, practical optimizations** without killing system services or
breaking Android internals.

The goal is simple: fewer shell loops, fewer unnecessary wakeups, and
predictable behavior.

------------------------------------------------------------------------

## What UltraOpt Does

### 1) Smart CPU Hibernation (core feature)

**hibernation (C++ daemon)**

-   Screen **ON** → applies `DEFAULT_GOV`
-   Screen **OFF** → applies `SLEEP_GOV`
-   Reads configuration **on the fly** (no reboot required)
-   Event‑driven design → minimal battery usage
-   Writes activity log to `hibernation.log`

### 2) Utility Toolbox (CLI)

**ultraopt (C++ tool)**

Provides useful maintenance and optimization commands accessible from
terminal or menu.

> Important: UltraOpt does not promise "magic FPS boosts". Real effect
> depends on device, kernel, and thermal limits.

------------------------------------------------------------------------

## Installation

1.  Install the module via **Magisk / APatch / KSU (KSUnext)**
2.  Reboot the device
3.  Open terminal and run:

```
su -c ultraopt
```

------------------------------------------------------------------------

## Basic Usage (CLI)

Examples:

``` sh
su -c ultraopt -ram
su -c ultraopt -clean
su -c ultraopt -dex
su -c ultraopt -bg
su -c ultraopt -tcp
su -c ultraopt -h
```

------------------------------------------------------------------------

## Configuration

Config file location:

    /data/adb/modules/UltrOpt/mod.cfg

Example:

``` ini
DEFAULT_GOV=schedutil
SLEEP_GOV=powersave

TCP_CC=bbr3
CHECK_INTERVAL=5
```

Changes apply automatically --- no reboot required.

------------------------------------------------------------------------

## Logs

Hibernation log:

    /data/adb/modules/UltrOpt/hibernation.log

------------------------------------------------------------------------

## Compatibility

-   **Android 8 and below** --- ❌ not supported (installation blocked)
-   **Android 9--10** --- ⚠️ supported with warning (older platform)
-   **Android 11--15** --- ✅ fully supported (recommended)
-   **Android 16** --- ⚠️ supported with warning (new platform)

Preferably for 64‑bit devices, but 32‑bit binaries may be included if
built.

------------------------------------------------------------------------

## Safety Principles

-   No killing services every few minutes
-   No automatic deletion of ANR/tombstones that hides real problems
-   All changes are reversible by removing the module
-   Safe fallbacks if requested governor is unavailable

------------------------------------------------------------------------

## Uninstall

1.  Disable or remove the module in Magisk / APatch / KSU
2.  Reboot
3.  System behavior returns to default

------------------------------------------------------------------------

## Philosophy

**Less scripting. More control. Predictable behavior.**

UltraOpt applies optimizations only where they make sense, without
breaking the system.
