Repository navigation
feat: widget stack remembers its position across reboots - #1409
Merged
sameerasw merged 2 commits intoOct 18, 2026
Merged
Conversation
Each stack's current widget was only kept in memory, so a reboot, app update or killed process sent every stack back to its first widget. Positions are now saved per stack in widget_stack_prefs after an arrow or edge step, when the screen turns off and when the app is moved to the background, and restored (clamped to the hosted widgets) on start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sameerasw
force-pushed
the
feat/001-widget-stack-position
branch
from
October 18, 2026 03:28
0bcbe2d to
20c9f02
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #1328 (widget stack).
Before: each stack's current widget was only kept in memory, so after a reboot, an app update or the process being killed, every stack went back to its first widget.
After: a stack comes back showing the widget it was on.
How: positions are saved per stack in the existing
widget_stack_prefsfile (position_<stackWidgetId>), next to the stack configs, and restored whenStackHoststarts. A smallStackPositions.restoreclamps each saved position to the stack's current widgets and drops positions for stacks that no longer exist. Positions are saved:onTrimMemory), because a cached app gets frozen and doesn't receiveSCREEN_OFFuntil it wakes.They aren't saved on every timer tick, so a running stack doesn't write to disk every few seconds. Removing a stack also removes its saved position.
Type of change
UI changes
None.
Checklist
develop(notmain)../gradlew assembleDebug../gradlew testDebugUnitTest(newStackPositionsTest, 6 tests).WidgetStackRepositoryalongside the stack configs, as the widget stack already stores its data there; no new user-facing preference.FeatureRegistry.kt.🤖 Generated with Claude Code