Implement notification grouping on Android
ClosedPublic

Authored by vkrause on Fri, May 1, 2:19 PM.

Details

Summary

This is available starting at API level 20, which is below our minimal
requirement. Grouping can be disabled by the already existing SkipGrouping
flag.

When enabled this puts all notifications from the same eventId in a group,
which makes the display more compact by removing the otherwise duplicated
app name.

Diff Detail

Repository
R289 KNotifications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
vkrause created this revision.Fri, May 1, 2:19 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFri, May 1, 2:19 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
vkrause requested review of this revision.Fri, May 1, 2:19 PM

Collapsed:


Expanded:

nicolasfella accepted this revision.Fri, May 1, 2:33 PM
nicolasfella added a subscriber: nicolasfella.

Haven't tested it, but the code looks sensible

src/android/org/kde/knotifications/NotifyByAndroid.java
258
This revision is now accepted and ready to land.Fri, May 1, 2:33 PM
vkrause added inline comments.Fri, May 1, 2:39 PM
src/android/org/kde/knotifications/NotifyByAndroid.java
258

That seems counter-productive to me, as the Android API documentation always speaks about API level numbers, so you'd need to do an additional translation to/from the letters in your head. So for that I find "26" more useful here than "O". It's also consistent with the rest of the code in this file.

nicolasfella added inline comments.Fri, May 1, 7:34 PM
src/android/org/kde/knotifications/NotifyByAndroid.java
258

You have a point

This isn't good to go yet, there are corner cases where the group summary item stays around after closing the last notification, working on fixing this.

vkrause updated this revision to Diff 81725.Sat, May 2, 8:42 AM

Explicitly track if notification groups are still in use.

This fixes group summaries staying active when we explicitly
close a notification, rather then having the user or system
dismiss it.

Still not good enough, updating existing notfication messes up the refcounter, resulting still in leftover group elements.

vkrause updated this revision to Diff 81731.Sat, May 2, 9:58 AM

Replace the simple ref count with a full child id tracking.

The ref count got out of sync when an existing notification is updated, using a set fixes that.

This revision was automatically updated to reflect the committed changes.