Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0ecea75 authored by Valentin Iftime's avatar Valentin Iftime Committed by Iavor-Valentin Iftime
Browse files

Notification API hardening: add statsd logs for forced auto-grouping events

 Add NotificationEvents:
  - NOTIFICATION_FORCE_GROUP: autogrouped child notification without summary
  - NOTIFICATION_FORCE_GROUP_SUMMARY: autogrouped summary notification without children
 Sparse/singleton groups summary cancelation is tracked by REASON_GROUP_OPTIMIZATION.

 Also added EventLog NOTIFICATION_SUMMARY_CONVERTED.

Flag: android.service.notification.notification_force_grouping
Flag: com.android.server.notification.notification_force_group_singletons
Flag: android.service.notification.notification_silent_flag

Test: manual via statsd_testdrive

Bug: 336488844
Change-Id: I83704994166f36c44742aeacfa7a567594c13afb
parent e511546f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ option java_package com.android.server
27535 notification_adjusted (key|3),(adjustment_type|3),(new_value|3)
# when a notification cancellation is prevented by the system
27536 notification_cancel_prevented (key|3)
# when a summary notification is converted to a regular notification because of force autogrouping
27537 notification_summary_converted (key|3)

# ---------------------------
# Watchdog.java
+7 −0
Original line number Diff line number Diff line
@@ -6783,6 +6783,9 @@ public class NotificationManagerService extends SystemService {
            if (notificationForceGrouping()) {
                if (r.getSbn().isAppGroup()) {
                    mListeners.notifyPostedLocked(r, r);
                    mNotificationRecordLogger.log(
                        NotificationRecordLogger.NotificationEvent.NOTIFICATION_FORCE_GROUP, r);
                }
            }
        }
@@ -6963,6 +6966,10 @@ public class NotificationManagerService extends SystemService {
            // Clear summary flag
            StatusBarNotification sbn = r.getSbn();
            sbn.getNotification().flags = (r.mOriginalFlags & ~FLAG_GROUP_SUMMARY);
            EventLogTags.writeNotificationSummaryConverted(key);
            mNotificationRecordLogger.log(
                NotificationRecordLogger.NotificationEvent.NOTIFICATION_FORCE_GROUP_SUMMARY, r);
            return true;
        }
        return false;
+5 −1
Original line number Diff line number Diff line
@@ -313,7 +313,11 @@ interface NotificationRecordLogger {
        @UiEvent(doc = "Notification assistant generated notification action at 1 was clicked.")
        NOTIFICATION_ASSIST_ACTION_CLICKED_1(457),
        @UiEvent(doc = "Notification assistant generated notification action at 2 was clicked.")
        NOTIFICATION_ASSIST_ACTION_CLICKED_2(458);
        NOTIFICATION_ASSIST_ACTION_CLICKED_2(458),
        @UiEvent(doc = "Notification was force autogrouped.")
        NOTIFICATION_FORCE_GROUP(1843),
        @UiEvent(doc = "Notification summary was force autogrouped.")
        NOTIFICATION_FORCE_GROUP_SUMMARY(1844);

        private final int mId;
        NotificationEvent(int id) {