Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLogger.java +30 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,13 @@ package com.android.systemui.statusbar.notification.logging; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_ALERTING; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_FOREGROUND_SERVICE; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_HEADS_UP; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_MEDIA_CONTROLS; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_PEOPLE; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_SILENT; import android.annotation.Nullable; import android.service.notification.StatusBarNotification; Loading @@ -23,6 +30,7 @@ import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.logging.nano.Notifications; import com.android.systemui.statusbar.notification.stack.PriorityBucket; import java.util.List; /** Loading Loading @@ -84,7 +92,7 @@ public interface NotificationPanelLogger { if (n.getNotification() != null) { proto.isGroupSummary = n.getNotification().isGroupSummary(); } proto.section = 1 + ne.getBucket(); // We want 0 to mean not set / unknown proto.section = toNotificationSection(ne.getBucket()); proto_array[i] = proto; } ++i; Loading @@ -92,4 +100,25 @@ public interface NotificationPanelLogger { notificationList.notifications = proto_array; return notificationList; } /** * Maps PriorityBucket enum to Notification.SECTION constant. The two lists should generally * use matching names, but the values may differ, because PriorityBucket order changes from * time to time, while logs need to have stable meanings. * @param bucket PriorityBucket constant * @return Notification.SECTION constant */ static int toNotificationSection(@PriorityBucket int bucket) { switch(bucket) { case BUCKET_MEDIA_CONTROLS : return Notifications.Notification.SECTION_MEDIA_CONTROLS; case BUCKET_HEADS_UP: return Notifications.Notification.SECTION_HEADS_UP; case BUCKET_FOREGROUND_SERVICE: return Notifications.Notification.SECTION_FOREGROUND_SERVICE; case BUCKET_PEOPLE: return Notifications.Notification.SECTION_PEOPLE; case BUCKET_ALERTING: return Notifications.Notification.SECTION_ALERTING; case BUCKET_SILENT: return Notifications.Notification.SECTION_SILENT; } return Notifications.Notification.SECTION_UNKNOWN; } } packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/Notifications.proto +7 −4 Original line number Diff line number Diff line Loading @@ -33,13 +33,16 @@ message Notification { optional bool is_group_summary = 5; // The section of the shade that the notification is in. // See NotificationSectionsManager.PriorityBucket. // Sections follow NotificationSectionsManager.PriorityBucket but enum constants do not, // as PriorityBucket order changes from time to time, while logs need to have stable meanings. enum NotificationSection { SECTION_UNKNOWN = 0; SECTION_HEADS_UP = 1; SECTION_PEOPLE = 2; SECTION_ALERTING = 3; SECTION_SILENT = 4; SECTION_MEDIA_CONTROLS = 2; SECTION_PEOPLE = 3; SECTION_ALERTING = 4; SECTION_SILENT = 5; SECTION_FOREGROUND_SERVICE = 6; } optional NotificationSection section = 6; } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java +2 −4 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.notification.logging; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_ALERTING; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; Loading Loading @@ -200,7 +198,7 @@ public class NotificationLoggerTest extends SysuiTestCase { assertEquals(TEST_UID, n.uid); assertEquals(1, n.instanceId); assertFalse(n.isGroupSummary); assertEquals(1 + BUCKET_ALERTING, n.section); assertEquals(Notifications.Notification.SECTION_ALERTING, n.section); } @Test Loading @@ -217,7 +215,7 @@ public class NotificationLoggerTest extends SysuiTestCase { assertEquals(TEST_UID, n.uid); assertEquals(1, n.instanceId); assertFalse(n.isGroupSummary); assertEquals(1 + BUCKET_ALERTING, n.section); assertEquals(Notifications.Notification.SECTION_ALERTING, n.section); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLogger.java +30 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,13 @@ package com.android.systemui.statusbar.notification.logging; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_ALERTING; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_FOREGROUND_SERVICE; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_HEADS_UP; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_MEDIA_CONTROLS; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_PEOPLE; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_SILENT; import android.annotation.Nullable; import android.service.notification.StatusBarNotification; Loading @@ -23,6 +30,7 @@ import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.logging.nano.Notifications; import com.android.systemui.statusbar.notification.stack.PriorityBucket; import java.util.List; /** Loading Loading @@ -84,7 +92,7 @@ public interface NotificationPanelLogger { if (n.getNotification() != null) { proto.isGroupSummary = n.getNotification().isGroupSummary(); } proto.section = 1 + ne.getBucket(); // We want 0 to mean not set / unknown proto.section = toNotificationSection(ne.getBucket()); proto_array[i] = proto; } ++i; Loading @@ -92,4 +100,25 @@ public interface NotificationPanelLogger { notificationList.notifications = proto_array; return notificationList; } /** * Maps PriorityBucket enum to Notification.SECTION constant. The two lists should generally * use matching names, but the values may differ, because PriorityBucket order changes from * time to time, while logs need to have stable meanings. * @param bucket PriorityBucket constant * @return Notification.SECTION constant */ static int toNotificationSection(@PriorityBucket int bucket) { switch(bucket) { case BUCKET_MEDIA_CONTROLS : return Notifications.Notification.SECTION_MEDIA_CONTROLS; case BUCKET_HEADS_UP: return Notifications.Notification.SECTION_HEADS_UP; case BUCKET_FOREGROUND_SERVICE: return Notifications.Notification.SECTION_FOREGROUND_SERVICE; case BUCKET_PEOPLE: return Notifications.Notification.SECTION_PEOPLE; case BUCKET_ALERTING: return Notifications.Notification.SECTION_ALERTING; case BUCKET_SILENT: return Notifications.Notification.SECTION_SILENT; } return Notifications.Notification.SECTION_UNKNOWN; } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/Notifications.proto +7 −4 Original line number Diff line number Diff line Loading @@ -33,13 +33,16 @@ message Notification { optional bool is_group_summary = 5; // The section of the shade that the notification is in. // See NotificationSectionsManager.PriorityBucket. // Sections follow NotificationSectionsManager.PriorityBucket but enum constants do not, // as PriorityBucket order changes from time to time, while logs need to have stable meanings. enum NotificationSection { SECTION_UNKNOWN = 0; SECTION_HEADS_UP = 1; SECTION_PEOPLE = 2; SECTION_ALERTING = 3; SECTION_SILENT = 4; SECTION_MEDIA_CONTROLS = 2; SECTION_PEOPLE = 3; SECTION_ALERTING = 4; SECTION_SILENT = 5; SECTION_FOREGROUND_SERVICE = 6; } optional NotificationSection section = 6; } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java +2 −4 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.notification.logging; import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_ALERTING; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; Loading Loading @@ -200,7 +198,7 @@ public class NotificationLoggerTest extends SysuiTestCase { assertEquals(TEST_UID, n.uid); assertEquals(1, n.instanceId); assertFalse(n.isGroupSummary); assertEquals(1 + BUCKET_ALERTING, n.section); assertEquals(Notifications.Notification.SECTION_ALERTING, n.section); } @Test Loading @@ -217,7 +215,7 @@ public class NotificationLoggerTest extends SysuiTestCase { assertEquals(TEST_UID, n.uid); assertEquals(1, n.instanceId); assertFalse(n.isGroupSummary); assertEquals(1 + BUCKET_ALERTING, n.section); assertEquals(Notifications.Notification.SECTION_ALERTING, n.section); } Loading