summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Valentin Iftime <valiiftime@google.com> 2024-06-21 17:53:43 +0200
committer Iavor-Valentin Iftime <valiiftime@google.com> 2024-09-24 12:14:02 +0000
commitf0ecea75b7d01a7496c62170f83ecb756d242972 (patch)
treeb78931837d09b22294c22bd7ff024b03ac32a87d
parente511546f7fb29832a2e4d36cc9c675d9de711656 (diff)
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
-rw-r--r--services/core/java/com/android/server/EventLogTags.logtags2
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java7
-rw-r--r--services/core/java/com/android/server/notification/NotificationRecordLogger.java6
3 files changed, 14 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags
index fd512a64b32c..5b271a3730fc 100644
--- a/services/core/java/com/android/server/EventLogTags.logtags
+++ b/services/core/java/com/android/server/EventLogTags.logtags
@@ -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
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 54e918972d46..a3ad355797de 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -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;
diff --git a/services/core/java/com/android/server/notification/NotificationRecordLogger.java b/services/core/java/com/android/server/notification/NotificationRecordLogger.java
index 65ef53f1df14..3943aa583fee 100644
--- a/services/core/java/com/android/server/notification/NotificationRecordLogger.java
+++ b/services/core/java/com/android/server/notification/NotificationRecordLogger.java
@@ -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) {