Skip to content

Use IMPORTANCE_LOW for ongoing notification, don't show a badge

akwizgran requested to merge 1075-1146-1317-ongoing-notification into master

This branch changes the importance level of our ongoing notification from IMPORTANCE_NONE to IMPORTANCE_LOW.

Previously we used IMPORTANCE_NONE to prevent the ongoing notification from being shown in the status bar on API 26. Unfortunately, testing on fresh emulator images shows that this no longer works (it may have broken when we raised our target API level to 26). Instead, on API 26 and 27, IMPORTANCE_NONE causes the system to show its own "Briar is running in the background - Tap for details on data and battery usage" notification in the status bar as soon as the app goes into the background. Setting IMPORTANCE_LOW causes our own notification to be shown instead, which I think is preferable. The system notification didn't appear alongside our notification after running for 90 minutes on API 27 (#1075 (closed)).

On API 28+ our notification is shown regardless of whether we use IMPORTANCE_NONE or IMPORTANCE_LOW.

On API 26-27, if the user manually turns off our notification then the system notification is shown instead (this behaviour is unchanged, as noted here). On API 28+, if the user manually turns off our notification then the system notification is not shown.

On API < 26 the behaviour is unchanged: there are no importance levels and we continue to use PRIORITY_MIN to hide the notification.

This branch also disables the notification dot (badge) for the ongoing notification, so the app icon only shows a dot when there are new messages/blog posts/etc.

Closes #1075 (closed), #1146 (closed), #1317 (closed). (There doesn't appear to be a solution for #1146 (closed) so I suggest we close it.)

Test instructions:

  • On API 26, 27 and 28 the "Signed into Briar" notification should be shown in the status bar and the notification drawer when signed in. The system's "Briar is running in the background" notification shouldn't be shown in the status bar or the notification drawer.
  • On API 26, 27 and 28 it should be possible to swipe the "Signed into Briar" notification to the left in the notification drawer to reveal a gear icon. Tapping the gear icon should allow the notification to be minimized or turned off (the language used to describe this varies with each API level). On API 26 and 27 this should result in the system's "Briar is running in the background" notification being shown instead. On API 28 no system notification should be shown.
  • On API 26, 27 and 28 the app icon shouldn't have a dot on its corner when signed in, unless there are unread messages/blog posts/etc, in which case a dot should be shown.
Edited by akwizgran

Merge request reports