Skip to content

fix: show the alarm label in the upcoming-alarm notification#469

Open
MiMoHo wants to merge 1 commit into
FossifyOrg:mainfrom
MiMoHo:fix/issue-183
Open

fix: show the alarm label in the upcoming-alarm notification#469
MiMoHo wants to merge 1 commit into
FossifyOrg:mainfrom
MiMoHo:fix/issue-183

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 3, 2026

Copy link
Copy Markdown

Type of change(s)

  • Bug fix

What changed and why

The "Upcoming Alarm" notification (shown ~10 minutes before an alarm fires) only displayed the day and time, never the alarm's label. Its content text was set from Context.getClosestEnabledAlarmString, which by design produces only a "$dayOfWeek $formattedTime" string (e.g. "Mon 07:30"). That helper is intentionally shared with the in-app "next alarm" text (ClockFragment) and the digital home-screen widget (MyDigitalTimeWidgetProvider), both of which should keep showing only the time, so the label must not be appended there.

The fix is localized to UpcomingAlarmReceiver, which already receives the specific ALARM_ID through its PendingIntent. It now looks up that alarm by id (context.dbHelper.getAlarmWithId(alarmId)?.label) on the existing goAsync background (Dispatchers.IO) thread and appends the label to the notification content text as "$alarmString - $label" only when a label is present. When the alarm has no label, the notification text is unchanged. No shared code paths are affected.

Tests performed

Verified on a real Android 15 (API 35) emulator with the foss debug build installed. I created an enabled alarm scheduled a few minutes in the future and drove UpcomingAlarmReceiver for that alarm id, exactly as AlarmManager does ~10 minutes before an alarm fires. With the alarm labeled "Standup meeting", the posted "Upcoming alarm" notification's content text read Sat 12:17 AM - Standup meeting (confirmed both in dumpsys notification and visually in the notification shade). Repeating with the label cleared produced Sat 12:17 AM with no trailing " - " separator, and the shared getClosestEnabledAlarmString output (the Sat 12:17 AM portion) never contained the label — proving the change is localized to the receiver and the in-app "next alarm"/widget text is untouched. CI (detekt, lint, unit tests, build) also passes.

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator.
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • I understand every change in this pull request.

Coded with Opus 4.8 ultracode.

The upcoming-alarm notification only displayed the day and time from getClosestEnabledAlarmString, which is shared with the clock UI and digital widget and intentionally omits the label. Look up the specific alarm by its ALARM_ID (already passed via the PendingIntent) in UpcomingAlarmReceiver and append its label to the notification content text when present, leaving the shared helper untouched.

Closes FossifyOrg#183
@MiMoHo MiMoHo requested a review from naveensingh as a code owner July 3, 2026 21:44
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.

Upcoming Alarm Notification does not show Label

1 participant