Repository navigation
Alarm screen: drop doses answered elsewhere, close when none are left #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
17667bb
Alarm screen: drop doses answered elsewhere, close when none are left
SusieeTheLinuxUser 7e9f17b
Merge master (PR #38); its stale-alarm-screen note now points at this…
SusieeTheLinuxUser 9879a6b
Alarm screen: remember answered doses across the app being killed
SusieeTheLinuxUser 5ef73eb
Alarm screen: a rebuilt screen older than the answered list closes
SusieeTheLinuxUser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: SusieeTheLinuxUser/dosekeeper
Length of output: 18937
Web query:
Android Activity getIntent putExtras modify intent process death recreation original intent ActivityRecord Android 12Result:
Script executed:
Repository: SusieeTheLinuxUser/dosekeeper
Length of output: 31427
Web query:
site:android.googlesource.com/platform/frameworks/base android 12 ActivityTaskSupervisor realStartActivityLocked LaunchActivityItem obtain r.intent process restartResult:
Preserve removed doses across process restoration.
If Android restores the screen after process death, it can restore the original dose list. Snooze can then re-arm an answered dose.
Persist the removals and apply them on restoration. Include removals made while the screen is stopped, and keep doses whose status is unknown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid, fixed in 9879a6b. Answered ids are now saved (own prefs file, pruned after 2 days). The screen filters them out in onCreate (so a screen rebuilt after process death drops them, and closes if none are left) and again right before Taken/Snooze act, so Snooze can't re-arm one. Unknown doses are kept: only ids positively answered via cancelFallback are dropped. An id is cleared again whenever its alarm fires (AlarmReceiver) or rings (AlarmService.startRinging, which also covers a START_REDELIVER_INTENT ring), so a ringing dose is never hidden from the screen that stops it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
Length of output: 23773
@SusieeTheLinuxUserThe fix covers restoration while the answered ID remains in preferences. I found one remaining case inAlarmActivity.ktat Line 193:Please retain the answered state until the stale screen can no longer be restored, or use another durable check. Please also test restoration after pruning. I checked the code but did not run a device test.
Learnings used
You are interacting with an AI system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5ef73eb: the screen saves when it first opened in its instance state (kept by the system across process death). A rebuilt screen older than the 2-day answered window closes itself instead of offering Snooze, so a pruned id can't be re-armed through one. Its doses are long past the 2h missed grace by then, and the missed-dose notification covers them. Not device-tested (no device on this run); manual steps are in AGENTS.md.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
Length of output: 30261
@SusieeTheLinuxUserCode inspection supports the fix. If Android restores the savedopenedAtvalue, the screen closes when it is older than the answered-ID retention window.The requested restoration-after-pruning test is still pending. When an emulator is available, please kill the backgrounded process, answer a dose, trigger pruning after two days, and restore the screen. Confirm that it closes without offering Snooze.
Learnings added
You are interacting with an AI system.