Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.logging; import com.android.systemui.statusbar.notification.collection.EntryAdapter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.logging.nano.Notifications; Loading Loading @@ -49,6 +50,11 @@ public class NotificationPanelLoggerFake implements NotificationPanelLogger { public void logNotificationDrag(NotificationEntry draggedNotification) { } @Override public void logNotificationDrag(EntryAdapter draggedNotification) { } public static class CallRecord { public boolean isLockscreen; public Notifications.NotificationList list; Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java +24 −4 Original line number Diff line number Diff line Loading @@ -40,9 +40,12 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.shade.ShadeController; import com.android.systemui.statusbar.notification.collection.EntryAdapter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.headsup.PinnedStatus; import com.android.systemui.statusbar.notification.logging.NotificationPanelLogger; import com.android.systemui.statusbar.notification.headsup.HeadsUpManager; import com.android.systemui.statusbar.notification.shared.NotificationBundleUi; import org.junit.Before; import org.junit.Test; Loading Loading @@ -99,7 +102,13 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { mRow.doDragCallback(0, 0); verify(controller).startDragAndDrop(mRow); verify(mHeadsUpManager, times(1)).releaseAllImmediately(); verify(mNotificationPanelLogger, times(1)).logNotificationDrag(any()); if (NotificationBundleUi.isEnabled()) { verify(mNotificationPanelLogger, times(1)) .logNotificationDrag(any(EntryAdapter.class)); } else { verify(mNotificationPanelLogger, times(1)) .logNotificationDrag(any(NotificationEntry.class)); } } @Test Loading @@ -111,7 +120,13 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { verify(controller).startDragAndDrop(mRow); verify(mShadeController).animateCollapseShade(eq(0), eq(true), eq(false), anyFloat()); verify(mNotificationPanelLogger, times(1)).logNotificationDrag(any()); if (NotificationBundleUi.isEnabled()) { verify(mNotificationPanelLogger, times(1)) .logNotificationDrag(any(EntryAdapter.class)); } else { verify(mNotificationPanelLogger, times(1)) .logNotificationDrag(any(NotificationEntry.class)); } } @Test Loading @@ -129,8 +144,13 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { // Verify that we never start the actual drag since there is no content verify(mRow, never()).startDragAndDrop(any(), any(), any(), anyInt()); verify(mNotificationPanelLogger, never()).logNotificationDrag(any()); } if (NotificationBundleUi.isEnabled()) { verify(mNotificationPanelLogger, never()) .logNotificationDrag(any(EntryAdapter.class)); } else { verify(mNotificationPanelLogger, never()) .logNotificationDrag(any(NotificationEntry.class)); } } private ExpandableNotificationRowDragController createSpyController() { return spy(mController); Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationGroupingUtil.java +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class NotificationGroupingUtil { } return null; } else { return row.getEntry().getSbn().getNotification(); return row.getEntryLegacy().getSbn().getNotification(); } } }; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLogger.java +39 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.service.notification.StatusBarNotification; import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; import com.android.systemui.statusbar.notification.collection.EntryAdapter; 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; Loading Loading @@ -64,6 +65,8 @@ public interface NotificationPanelLogger { */ void logNotificationDrag(NotificationEntry draggedNotification); void logNotificationDrag(EntryAdapter draggedNotification); enum NotificationPanelEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "Notification panel shown from status bar.") NOTIFICATION_PANEL_OPEN_STATUS_BAR(200), Loading Loading @@ -122,6 +125,42 @@ public interface NotificationPanelLogger { return notificationList; } /** * Composes a NotificationsList proto from the list of visible notifications. * @param visibleNotifications as provided by NotificationEntryManager.getVisibleNotifications() * @return NotificationList proto suitable for SysUiStatsLog.write(NOTIFICATION_PANEL_REPORTED) */ static Notifications.NotificationList adapterToNotificationProto( @Nullable List<EntryAdapter> visibleNotifications) { Notifications.NotificationList notificationList = new Notifications.NotificationList(); if (visibleNotifications == null) { return notificationList; } final Notifications.Notification[] proto_array = new Notifications.Notification[visibleNotifications.size()]; int i = 0; for (EntryAdapter ne : visibleNotifications) { final StatusBarNotification n = ne.getSbn(); if (n != null) { final Notifications.Notification proto = new Notifications.Notification(); proto.uid = n.getUid(); proto.packageName = n.getPackageName(); if (n.getInstanceId() != null) { proto.instanceId = n.getInstanceId().getId(); } // TODO set np.groupInstanceId if (n.getNotification() != null) { proto.isGroupSummary = n.getNotification().isGroupSummary(); } proto.section = toNotificationSection(ne.getSectionBucket()); proto_array[i] = proto; } ++i; } 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 Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerImpl.java +12 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.logging; import static com.android.systemui.statusbar.notification.logging.NotificationPanelLogger.NotificationPanelEvent.NOTIFICATION_DRAG; import com.android.systemui.shared.system.SysUiStatsLog; import com.android.systemui.statusbar.notification.collection.EntryAdapter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.logging.nano.Notifications; import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor; Loading Loading @@ -62,4 +63,15 @@ public class NotificationPanelLoggerImpl implements NotificationPanelLogger { /* num_notifications = */ proto.notifications.length, /* notifications = */ MessageNano.toByteArray(proto)); } @Override public void logNotificationDrag(EntryAdapter draggedNotification) { final Notifications.NotificationList proto = NotificationPanelLogger.adapterToNotificationProto( Collections.singletonList(draggedNotification)); SysUiStatsLog.write(SysUiStatsLog.NOTIFICATION_PANEL_REPORTED, /* event_id = */ NOTIFICATION_DRAG.getId(), /* num_notifications = */ proto.notifications.length, /* notifications = */ MessageNano.toByteArray(proto)); } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.logging; import com.android.systemui.statusbar.notification.collection.EntryAdapter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.logging.nano.Notifications; Loading Loading @@ -49,6 +50,11 @@ public class NotificationPanelLoggerFake implements NotificationPanelLogger { public void logNotificationDrag(NotificationEntry draggedNotification) { } @Override public void logNotificationDrag(EntryAdapter draggedNotification) { } public static class CallRecord { public boolean isLockscreen; public Notifications.NotificationList list; Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java +24 −4 Original line number Diff line number Diff line Loading @@ -40,9 +40,12 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.shade.ShadeController; import com.android.systemui.statusbar.notification.collection.EntryAdapter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.headsup.PinnedStatus; import com.android.systemui.statusbar.notification.logging.NotificationPanelLogger; import com.android.systemui.statusbar.notification.headsup.HeadsUpManager; import com.android.systemui.statusbar.notification.shared.NotificationBundleUi; import org.junit.Before; import org.junit.Test; Loading Loading @@ -99,7 +102,13 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { mRow.doDragCallback(0, 0); verify(controller).startDragAndDrop(mRow); verify(mHeadsUpManager, times(1)).releaseAllImmediately(); verify(mNotificationPanelLogger, times(1)).logNotificationDrag(any()); if (NotificationBundleUi.isEnabled()) { verify(mNotificationPanelLogger, times(1)) .logNotificationDrag(any(EntryAdapter.class)); } else { verify(mNotificationPanelLogger, times(1)) .logNotificationDrag(any(NotificationEntry.class)); } } @Test Loading @@ -111,7 +120,13 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { verify(controller).startDragAndDrop(mRow); verify(mShadeController).animateCollapseShade(eq(0), eq(true), eq(false), anyFloat()); verify(mNotificationPanelLogger, times(1)).logNotificationDrag(any()); if (NotificationBundleUi.isEnabled()) { verify(mNotificationPanelLogger, times(1)) .logNotificationDrag(any(EntryAdapter.class)); } else { verify(mNotificationPanelLogger, times(1)) .logNotificationDrag(any(NotificationEntry.class)); } } @Test Loading @@ -129,8 +144,13 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { // Verify that we never start the actual drag since there is no content verify(mRow, never()).startDragAndDrop(any(), any(), any(), anyInt()); verify(mNotificationPanelLogger, never()).logNotificationDrag(any()); } if (NotificationBundleUi.isEnabled()) { verify(mNotificationPanelLogger, never()) .logNotificationDrag(any(EntryAdapter.class)); } else { verify(mNotificationPanelLogger, never()) .logNotificationDrag(any(NotificationEntry.class)); } } private ExpandableNotificationRowDragController createSpyController() { return spy(mController); Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationGroupingUtil.java +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class NotificationGroupingUtil { } return null; } else { return row.getEntry().getSbn().getNotification(); return row.getEntryLegacy().getSbn().getNotification(); } } }; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLogger.java +39 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.service.notification.StatusBarNotification; import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; import com.android.systemui.statusbar.notification.collection.EntryAdapter; 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; Loading Loading @@ -64,6 +65,8 @@ public interface NotificationPanelLogger { */ void logNotificationDrag(NotificationEntry draggedNotification); void logNotificationDrag(EntryAdapter draggedNotification); enum NotificationPanelEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "Notification panel shown from status bar.") NOTIFICATION_PANEL_OPEN_STATUS_BAR(200), Loading Loading @@ -122,6 +125,42 @@ public interface NotificationPanelLogger { return notificationList; } /** * Composes a NotificationsList proto from the list of visible notifications. * @param visibleNotifications as provided by NotificationEntryManager.getVisibleNotifications() * @return NotificationList proto suitable for SysUiStatsLog.write(NOTIFICATION_PANEL_REPORTED) */ static Notifications.NotificationList adapterToNotificationProto( @Nullable List<EntryAdapter> visibleNotifications) { Notifications.NotificationList notificationList = new Notifications.NotificationList(); if (visibleNotifications == null) { return notificationList; } final Notifications.Notification[] proto_array = new Notifications.Notification[visibleNotifications.size()]; int i = 0; for (EntryAdapter ne : visibleNotifications) { final StatusBarNotification n = ne.getSbn(); if (n != null) { final Notifications.Notification proto = new Notifications.Notification(); proto.uid = n.getUid(); proto.packageName = n.getPackageName(); if (n.getInstanceId() != null) { proto.instanceId = n.getInstanceId().getId(); } // TODO set np.groupInstanceId if (n.getNotification() != null) { proto.isGroupSummary = n.getNotification().isGroupSummary(); } proto.section = toNotificationSection(ne.getSectionBucket()); proto_array[i] = proto; } ++i; } 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 Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerImpl.java +12 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.logging; import static com.android.systemui.statusbar.notification.logging.NotificationPanelLogger.NotificationPanelEvent.NOTIFICATION_DRAG; import com.android.systemui.shared.system.SysUiStatsLog; import com.android.systemui.statusbar.notification.collection.EntryAdapter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.logging.nano.Notifications; import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor; Loading Loading @@ -62,4 +63,15 @@ public class NotificationPanelLoggerImpl implements NotificationPanelLogger { /* num_notifications = */ proto.notifications.length, /* notifications = */ MessageNano.toByteArray(proto)); } @Override public void logNotificationDrag(EntryAdapter draggedNotification) { final Notifications.NotificationList proto = NotificationPanelLogger.adapterToNotificationProto( Collections.singletonList(draggedNotification)); SysUiStatsLog.write(SysUiStatsLog.NOTIFICATION_PANEL_REPORTED, /* event_id = */ NOTIFICATION_DRAG.getId(), /* num_notifications = */ proto.notifications.length, /* notifications = */ MessageNano.toByteArray(proto)); } }