# CPU frequency ranges and profile governors ## Behavior Each CPU card uses one two-handle slider. The lower handle selects an optional minimum; the upper handle selects the maximum. The handles snap to advertised frequency bins and cannot cross. Equal minimum and maximum values are supported. Range labels use the existing frequency/percentage formatting. Saved profile cards and the current-values header show inline ranges. The editors show `min: …` above `max: …` at the right of each CPU slider. The minimum handle's far-left stop shows **min: Stock** and retains the previous automatic floor behavior, with no explicit minimum override. The next stop selects the lowest advertised explicit floor, so that remains distinct from Stock and saved profiles retain their meaning. Moving the handle back fully left removes the override without changing the maximum or governors. There is no separate minimum reset button. The maximum handle's far-right stop shows **max: Stock** and restores the Stock maximum. Returning only the maximum to Stock does not remove an explicitly selected floor. Applying the Stock profile releases explicit floors and owned governor overrides. CPU governor choices are per policy. A GPU governor menu appears only when a supported GPU exposes a governor node and an available-governors list. Menus contain Default and the names the device reports; ClusterTune does not assume that a particular governor exists. The GPU frequency slider continues to control its maximum only. **Default** releases ClusterTune's override and restores the governor captured before that override. A later external governor change is preserved rather than overwritten during release. Governor writes happen on profile events, with verification and rollback; there is no governor watcher or new polling timer. ## Persistence and automation `ProfileControls` carries optional CPU minimums, per-policy CPU governors, and a GPU governor. Saved profiles, custom app assignments, normal-state restoration, sleep snapshots, and shared profile files retain these settings. Share-file schema 3 adds optional controls; profiles from older schemas still load with Stock minimums (automatic floor behavior) and Default governors. Profile identity includes these settings, so changing only a minimum or governor creates a custom selection. A range profile remains distinct from a maximum-only profile with identical ceilings. Live minimum verification accepts a higher effective minimum from an independent system boost. For multiple visible fixed-profile apps, maximums use the existing component-wise maximum rule. Explicit minimum demands use the highest requested floor. Conflicting governors follow the focused contributor, with stable package order as a fallback. Relevant focus changes cause an existing app-profile event to apply the resulting settings. Before Auto Tune starts, the repository establishes the normal profile's controls if their intent changed or the observed settings no longer satisfy them. Its FPS actuator continues to write only maximums, using the existing minimum-aware envelope. The FPS loop does not choose new minimums or governors. No extra recovery loop was added. ## Privileged host Host protocol 16 carries governor capabilities, live governors, and requested minimums/governors. The host validates all requested controls against its discovered domains before making profile changes. Unsupported governor names and minimums above the requested maximum are rejected before mutation. Explicit floors extend the existing CPU minimum protection, including when the maximum is Stock. The minimum ownership journal records the requested floor, reads the previous journal format, and restores the previous floor after a failed profile change. Releasing a custom floor lowers it to the supported automatic floor before returning the original permissions; it does not replay a possibly boosted historical effective minimum. Governor ownership uses a separate root-private atomic journal and lifetime lock. The transaction captures the original governor, verifies writes and permissions, rolls back failures, and recovers interrupted ownership when a replacement host starts. Unverified release retains its recovery record for another attempt. Minimum/governor ownership is separate from Auto Tune's existing maximum-only session checkpoint. ## Validation UI testing uses the API 34 emulator in dark mode, with the production composables and deterministic example capabilities. These example frequency bins and governor names are test data, not a hardware capability report. No physical device was used for this feature. Results: **593 unit tests passed**. The emulator UI suite completed 80 cases: **78 passed**, with the two explicitly opt-in physical-device History scenarios skipped. All **4 production Binder serialization tests passed**. Debug and release APK builds, release vital lint, and debug lint completed successfully; debug lint reported zero errors (existing warnings remain). The tests cover: - Dragging both handles, equal endpoints, preventing crossed endpoints, returning either endpoint to Stock, keeping the lowest explicit floor selectable, vertical min/max label order, and canceling edits. - Saving, storage-codec round trips, reopening, selecting CPU governors, scrolling to the GPU governor, and restoring Default. - Compact-tuner apply behavior, including recognizing a minimum-only edit as a custom profile, and a narrow 320 dp editor keeping a usable slider width. - Real DataStore separation of normal and sleep controls; legacy storage/share compatibility. - Production Java/Kotlin Binder serialization for capabilities, requests, live state, and legacy empty controls. - Host simulation of explicit floors, CPU/GPU governors, invalid requests, Stock release, failed writes, rollback, replacement-host recovery, external changes, and retry after unverified release. - Existing unit and UI regression checks. Actual frequency/governor writes, available governor lists, firmware interference, and device-specific performance effects still require physical-device testing when the device is available. ## Dark-mode emulator screenshots All screenshots use temporary example data in the actual app UI. - [Profile list](research/frequency-ranges-2026-10-23/profiles-dark.png) - [CPU range editor](research/frequency-ranges-2026-10-23/profile-editor-dark.png) - [Stock endpoints](research/frequency-ranges-2026-10-23/stock-endpoints-dark.png) - [CPU governor menu](research/frequency-ranges-2026-10-23/governor-menu-dark.png) - [GPU governor menu after scrolling](research/frequency-ranges-2026-10-23/gpu-governor-open.png) - [Compact tuner](research/frequency-ranges-2026-10-23/compact-tuner-dark.png)