Fix prediction reminder re-arming, daily reminder reliability, and alarm scheduling bugs#167
Merged
Merged
Conversation
…arm scheduling bugs - Pre-period, ovulation, and daily reminders re-arm after each firing (ReminderReceiver) and after any period mutation (log/edit/delete/undo/ merge) via a shared ReminderScheduler.refreshPredictionReminders(); previously they were only armed at boot or from the settings screen - Replace the setRepeating daily during-period reminder with an exact one-shot that re-arms itself; setRepeating is inexact and Doze-deferred - Fix exact-alarm gating that downgraded all pre-Android-12 devices to inexact delivery (exact alarms need no permission below API 31) - Custom alarm snooze now uses a shared PendingIntent identity that cancelCustomAlarm also cancels, so deleting or disabling an alarm kills its pending snoozed firing; the receiver also checks isEnabled at fire - Re-arm recurring custom alarms before condition evaluation so an exception cannot break the chain - Compute next trigger times per local calendar day instead of adding 24h of millis, which drifted an hour across DST transitions - BootReceiver also handles MY_PACKAGE_REPLACED, TIMEZONE_CHANGED, and TIME_SET Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qs1UZLKHTxtaLpTheoUwTg
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.
Part of a cross-app review of how the four apps use AlarmManager for alarms and reminders. This PR fixes the GoFlo findings, the largest set of the four.
Bugs fixed
ReminderScheduler.refreshPredictionReminders()is now called from ReminderReceiver after each prediction firing and from every period mutation (log, edit, delete, undo, merge).setRepeating, which is inexact and Doze-deferred since KitKat, so it could arrive hours late or not at all. It is now an exact one-shot that re-arms itself via the receiver while a period is active, and ends naturally when the period ends.SDK >= S && canScheduleExactAlarms()sent every pre-12 device down the inexact branch, even though exact alarms need no permission there. Centralised intocanUseExactAlarms()/setAlarm()and applied to custom alarms, prediction reminders, and snooze.isEnabledat fire time. Snooze identity now lives inReminderScheduler.customAlarmSnoozePendingIntent,cancelCustomAlarmcancels it, and the receiver checksisEnabled.MY_PACKAGE_REPLACED,TIMEZONE_CHANGED, andTIME_SET(all exempt from implicit-broadcast restrictions, no new permission), since every alarm is armed at an absolute epoch computed from local times.Known issue left out (needs a permissions discussion)
ALARM-type custom alarms call
setFullScreenIntent, but the manifest does not declareUSE_FULL_SCREEN_INTENT. On Android 14+ targets the full-screen alarm UI is silently downgraded to a heads-up notification. Adding the permission is a one-line change, but Play policy restricts full-screen intent for non-alarm-category apps and CLAUDE.md requires discussion before adding permissions, so it is flagged here rather than changed.Changelog fragment:
changelog/unreleased/alarm-reliability.json(patch). LESSONS.md gains an entry on re-arming data-dependent one-shot alarms.a11y_check.pypasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01Qs1UZLKHTxtaLpTheoUwTg
Generated by Claude Code