Skip to content

feat: keep Focus mode immersive and screen awake - #3

Merged
eddiegulay merged 1 commit into
mainfrom
develop
Jun 30, 2026
Merged

feat: keep Focus mode immersive and screen awake#3
eddiegulay merged 1 commit into
mainfrom
develop

Conversation

@eddiegulay

Copy link
Copy Markdown
Owner

Summary

Hardens Focus mode so it stays a true distraction-free surface:

  • Status bar stays actively hidden. WindowInsetsControllerCompat.hide() is silently reverted whenever the window loses then regains focus (notification shade, toasts, permission prompts, returning from another app). We now re-apply the hide on every window-focus regain via a ViewTreeObserver.OnWindowFocusChangeListener, so the bar no longer creeps back. BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE still lets a deliberate swipe peek the bars, then they auto-hide.
  • Screen stays awake. view.keepScreenOn = true for the whole focus session so the clock is always readable. Scoped to the focus surface (not a raw window flag) and released on dispose.

Both are torn down in the existing onDispose alongside the orientation restore, so leaving Focus (Back or HOME) returns everything to normal.

Why this approach

  • Modifier.keepScreenOn() needs Compose Foundation 1.9; this project is on BOM 2025.01.00 (~1.7), so view.keepScreenOn is the version-appropriate equivalent with automatic cleanup.
  • A one-shot hide() on entry is not durable across focus changes — the focus-regain re-hide is the documented fix.

Verification

  • ./gradlew assembleDebug lintDebug — green locally (mirrors CI).
  • Changelog updated with a ## [0.0.8] section for the release notes.

Actively hold the system bars hidden by re-applying hide() on every
window-focus regain (the notification shade, toasts, permission
prompts, and returning from other apps otherwise revert it). Also
keep the screen on for the whole focus session so the clock stays
readable; both are scoped to the focus surface and released on exit.
@eddiegulay
eddiegulay merged commit ae1c9a7 into main Jun 30, 2026
1 check passed
@eddiegulay
eddiegulay deleted the develop branch June 30, 2026 11:47
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