Google is committed to advancing racial equity for Black communities. See how.

Notification History

Notification History is a device screen where users can see snoozed notifications, a handful of recently dismissed notifications, and a history of the last day of notifications. It is an optional feature for OEMs to implement. There's no impact on SoCs or carriers.

Notification History is meant to address these use cases:

  • Accidental dismissal: You accidentally dismissed a notification and want to get a quick look at what it was.
  • Snoozed notifications: You snoozed a notification but want to see it before the snooze period is over.
  • Troubleshooting: You think you missed a notification. You check the Notification History to see whether there was a notification and whether it buzzed. If you don't find it, you check whether a notification was blocked. You can change notification settings in Notification History.
  • Notification management: You want to change how interruptive notifications are, so you use Notification History because it offers a realistic slice of daily notification load, which makes it easy to understand the scope of your changes to alerting, blocking. etc.

Reference implementations of these components of Notification History are available:

  • Settings: packages/apps/Settings/src/com/android/settings/notification/history
  • System server: com.android.server.notification.NotificationHistory.*.java

These are the major steps to implement Notification History:

  • Write notification events to the log.
  • Add entry points to the log and the setting to turn it on and off.
  • Implement the Notification History screen.

Users can turn Notification History off. When it's off, all history items are deleted and no items are written to the log.

You can set the number of days notifications appear in the Notification History using the HISTORY_RETENTION_DAYS constant in the NotificationHistoryDatabase class. You can also modify which sections appear in the Notification History screen and how the data is presented.

The default notification history retention period is 24 hours.

These unit tests are provided for each component of the code:

  • System server unit tests: FrameworksUiServicesTests
  • Settings unit tests: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.notification"