Skip to content

Fix: Adaptive Brightness turns off during screen sleep/wake - #5

Open
chadchad4423 wants to merge 1 commit into
ScreenSensitive:mainfrom
chadchad4423:fix/preserve-adaptive-brightness
Open

Fix: Adaptive Brightness turns off during screen sleep/wake#5
chadchad4423 wants to merge 1 commit into
ScreenSensitive:mainfrom
chadchad4423:fix/preserve-adaptive-brightness

Conversation

@chadchad4423

@chadchad4423 chadchad4423 commented Aug 25, 2026

Copy link
Copy Markdown

Fix: Adaptive Brightness turns off during screen sleep/wake

KompaktX's brightness-apply path (applyBrightness()) unconditionally forced Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL on every call, including passive reapply calls that happen on wake/resume (reapplyBrightness(), loadSavedBrightness()). This meant that if a user had Adaptive Brightness enabled, it would silently get switched off any time the screen went to sleep and woke back up, or whenever KompaktX reapplied its saved brightness.

This PR adds a forceManualMode parameter (default true, preserving existing behavior for the paths that should force manual mode) and sets it to false for the two passive-reapply call sites, so they no longer force the mode switch.

Testing

Verified on a physical Mudita Kompakt (MuditaOS K 1.5) — enabled Adaptive Brightness, put the display to sleep, woke it, confirmed Adaptive Brightness was still on.

applyBrightness() unconditionally forced Settings.System.SCREEN_BRIGHTNESS_MODE
to MANUAL every time it ran -- including from reapplyBrightness(), which fires
on every ACTION_SCREEN_ON broadcast and every accessibility-service reconnect,
and from loadSavedBrightness(), which fires whenever the touch-strip service
(re)starts. Neither of those is the user touching a brightness control; both
are KompaktX passively restoring its last-known brightness. The net effect:
once KompaktX had ever set a brightness (which happens the first time its
overlay brightness control is used, and persists across restarts), turning
Adaptive Brightness back on in system settings never stuck -- the very next
screen wake silently flipped it back to manual.

Add a forceManualMode parameter to applyBrightness(), defaulting to true so
every direct user gesture (slider drag, sun-icon tap, front-light toggle)
keeps forcing manual mode, matching stock Android's own behavior when you
drag its brightness slider. The two passive-restore call sites now pass
false, so they reapply the physical brightness (still correct) without
silently overriding a system setting the user didn't just touch.

Scope note: buildBrightnessSection() and buildBrightnessSubPanel() still
force manual mode once each, at the top of the function, whenever KompaktX's
own brightness UI is displayed (not only when it's touched). That's a
smaller, separate quirk left out of this patch to keep it narrowly scoped to
the dominant bug -- the continuous every-wake override -- rather than
touching every place brightness mode is set.
@chadchad4423 chadchad4423 changed the title Preserve Adaptive Brightness setting through sleep/wake Fix: Adaptive Brightness turns off during screen sleep/wake Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant