Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -424,7 +424,8 @@ public class NotificationStackScrollLayoutController { } } }; }; private final NotificationSwipeHelper.NotificationCallback mNotificationCallback = @VisibleForTesting final NotificationSwipeHelper.NotificationCallback mNotificationCallback = new NotificationSwipeHelper.NotificationCallback() { new NotificationSwipeHelper.NotificationCallback() { @Override @Override Loading Loading @@ -483,10 +484,11 @@ public class NotificationStackScrollLayoutController { */ */ public void handleChildViewDismissed(View view) { public void handleChildViewDismissed(View view) { // The View needs to clean up the Swipe states, e.g. roundness. mView.onSwipeEnd(); if (mView.getClearAllInProgress()) { if (mView.getClearAllInProgress()) { return; return; } } mView.onSwipeEnd(); if (view instanceof ExpandableNotificationRow) { if (view instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) view; ExpandableNotificationRow row = (ExpandableNotificationRow) view; if (row.isHeadsUp()) { if (row.isHeadsUp()) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java +31 −0 Original line number Original line Diff line number Diff line Loading @@ -87,6 +87,7 @@ import com.android.systemui.statusbar.notification.init.NotificationsController; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController.NotificationPanelEvent; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController.NotificationPanelEvent; import com.android.systemui.statusbar.notification.stack.NotificationSwipeHelper.NotificationCallback; import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationListViewModel; import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationListViewModel; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardBypassController; Loading Loading @@ -414,6 +415,36 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { MetricsProto.MetricsEvent.TYPE_ACTION)); MetricsProto.MetricsEvent.TYPE_ACTION)); } } @Test public void callSwipeCallbacksDuringClearAll() { initController(/* viewIsAttached= */ true); ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationCallback notificationCallback = mController.mNotificationCallback; when(mNotificationStackScrollLayout.getClearAllInProgress()).thenReturn(true); notificationCallback.onBeginDrag(row); verify(mNotificationStackScrollLayout).onSwipeBegin(row); notificationCallback.handleChildViewDismissed(row); verify(mNotificationStackScrollLayout).onSwipeEnd(); } @Test public void callSwipeCallbacksDuringClearNotification() { initController(/* viewIsAttached= */ true); ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationCallback notificationCallback = mController.mNotificationCallback; when(mNotificationStackScrollLayout.getClearAllInProgress()).thenReturn(false); notificationCallback.onBeginDrag(row); verify(mNotificationStackScrollLayout).onSwipeBegin(row); notificationCallback.handleChildViewDismissed(row); verify(mNotificationStackScrollLayout).onSwipeEnd(); } @Test @Test public void testOnMenuClickedLogging() { public void testOnMenuClickedLogging() { ExpandableNotificationRow row = mock(ExpandableNotificationRow.class, RETURNS_DEEP_STUBS); ExpandableNotificationRow row = mock(ExpandableNotificationRow.class, RETURNS_DEEP_STUBS); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -424,7 +424,8 @@ public class NotificationStackScrollLayoutController { } } }; }; private final NotificationSwipeHelper.NotificationCallback mNotificationCallback = @VisibleForTesting final NotificationSwipeHelper.NotificationCallback mNotificationCallback = new NotificationSwipeHelper.NotificationCallback() { new NotificationSwipeHelper.NotificationCallback() { @Override @Override Loading Loading @@ -483,10 +484,11 @@ public class NotificationStackScrollLayoutController { */ */ public void handleChildViewDismissed(View view) { public void handleChildViewDismissed(View view) { // The View needs to clean up the Swipe states, e.g. roundness. mView.onSwipeEnd(); if (mView.getClearAllInProgress()) { if (mView.getClearAllInProgress()) { return; return; } } mView.onSwipeEnd(); if (view instanceof ExpandableNotificationRow) { if (view instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) view; ExpandableNotificationRow row = (ExpandableNotificationRow) view; if (row.isHeadsUp()) { if (row.isHeadsUp()) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java +31 −0 Original line number Original line Diff line number Diff line Loading @@ -87,6 +87,7 @@ import com.android.systemui.statusbar.notification.init.NotificationsController; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController.NotificationPanelEvent; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController.NotificationPanelEvent; import com.android.systemui.statusbar.notification.stack.NotificationSwipeHelper.NotificationCallback; import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationListViewModel; import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationListViewModel; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardBypassController; Loading Loading @@ -414,6 +415,36 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { MetricsProto.MetricsEvent.TYPE_ACTION)); MetricsProto.MetricsEvent.TYPE_ACTION)); } } @Test public void callSwipeCallbacksDuringClearAll() { initController(/* viewIsAttached= */ true); ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationCallback notificationCallback = mController.mNotificationCallback; when(mNotificationStackScrollLayout.getClearAllInProgress()).thenReturn(true); notificationCallback.onBeginDrag(row); verify(mNotificationStackScrollLayout).onSwipeBegin(row); notificationCallback.handleChildViewDismissed(row); verify(mNotificationStackScrollLayout).onSwipeEnd(); } @Test public void callSwipeCallbacksDuringClearNotification() { initController(/* viewIsAttached= */ true); ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationCallback notificationCallback = mController.mNotificationCallback; when(mNotificationStackScrollLayout.getClearAllInProgress()).thenReturn(false); notificationCallback.onBeginDrag(row); verify(mNotificationStackScrollLayout).onSwipeBegin(row); notificationCallback.handleChildViewDismissed(row); verify(mNotificationStackScrollLayout).onSwipeEnd(); } @Test @Test public void testOnMenuClickedLogging() { public void testOnMenuClickedLogging() { ExpandableNotificationRow row = mock(ExpandableNotificationRow.class, RETURNS_DEEP_STUBS); ExpandableNotificationRow row = mock(ExpandableNotificationRow.class, RETURNS_DEEP_STUBS); Loading