Skip to content

v2.5.7: Fix Orphaned Alarm on Schedule Edit #87 and Alarm Lifecycle Safeguards

Choose a tag to compare

@saad2134 saad2134 released this 26 Sep 13:11
· 183 commits to main since this release

v2.5.7: Fix Orphaned Alarm on Schedule Edit (#87) and Alarm Lifecycle Safeguards

Summary of Changes

Release v2.5.7 resolves an orphaned Android AlarmManager leak that could cause obsolete alarms to sound after modifying a medication's scheduled dose time (#87), introduces defensive filtering in MedicineAlarmReceiver to discard alarms for deleted or non-pending entries, and hardens background alarm lifecycles across Android 8 through Android 16.


📱 Patient App (Android)

  • Fix Orphaned Alarm Leak on Medication Schedule Edit (#87):
    • Resolved an ordering race in MedicineRepository.updateMedicine() where obsolete untaken schedule entries were deleted from Room SQLite before cancelAlarmsForMedicine() was invoked.
    • Alarms associated with old dose times (e.g. changing 08:00 to 09:00) are now explicitly cancelled in Android's AlarmManager while their schedule records still exist in the database, preventing orphaned alarm clock registrations and phantom wakeups.
  • Defensive Alarm Intent Validation in MedicineAlarmReceiver:
    • Added multi-entry verification ensuring that when an alarm broadcast arrives, it queries Room and validates whether any associated schedule entries are actively PENDING.
    • If entries were deleted or already completed, the receiver silently discards the alarm without triggering audio playback, vibration, or notifications.
    • If a grouped alarm contained multiple medications and only one was rescheduled, the receiver accurately filters and alerts only for the remaining pending medication.
  • Schedule Edit Unit Test Coverage:
    • Added MedicineRepositoryAlarmLifecycleTest to strictly verify and enforce that alarm cancellation precedes database row deletion during schedule updates.
  • Home Screen Widget Active Profile Display:
    • The home screen widget header now shows the active profile name (e.g. Dosezy • Name), making multi-profile medication monitoring clear at a glance.
    • Profile switching, creation, and profile name edits now trigger immediate widget refreshes.

🔍 Full Changelog & Compare

Compare v2.5.6...v2.5.7