Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java +19 −1 Original line number Diff line number Diff line Loading @@ -135,7 +135,25 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { } else { verify(mNotificationPanelLogger, never()) .logNotificationDrag(any(NotificationEntry.class)); } } } } @Test public void testCleanUpDragListenerOnDragFailed() { ExpandableNotificationRowDragController controller = createSpyController(); mRow.setDragController(controller); mRow.setHeadsUp(true); mRow.setPinnedStatus(PinnedStatus.PinnedBySystem); // Simulate a failure to initiate drag and drop doReturn(false).when(mRow).startDragAndDrop(any(), any(), any(), anyInt()); mRow.doLongClickCallback(0, 0); mRow.doDragCallback(0, 0); // Verify that we've reset the listener verify(mRow).setOnDragListener(null); } private ExpandableNotificationRowDragController createSpyController() { return spy(mController); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragController.java +7 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ public class ExpandableNotificationRowDragController { boolean result = view.startDragAndDrop(dragData, myShadow, null, View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_REQUEST_SURFACE_FOR_RETURN_ANIMATION); if (result) { Log.d(TAG, "Starting drag from notification view=" + view); // Log notification drag only if it succeeds if (NotificationBundleUi.isEnabled()) { mNotificationPanelLogger.logNotificationDrag(enr.getEntryAdapter()); Loading @@ -156,6 +157,9 @@ public class ExpandableNotificationRowDragController { } else { dismissShade(); } } else { Log.w(TAG, "Failed to starting drag from notification view=" + view); view.setOnDragListener(null); } } Loading Loading @@ -255,6 +259,9 @@ public class ExpandableNotificationRowDragController { } private void cleanUpSurface() { if (!dragSurface.isValid()) { return; } tx.remove(dragSurface); tx.apply(); tx.close(); Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java +19 −1 Original line number Diff line number Diff line Loading @@ -135,7 +135,25 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase { } else { verify(mNotificationPanelLogger, never()) .logNotificationDrag(any(NotificationEntry.class)); } } } } @Test public void testCleanUpDragListenerOnDragFailed() { ExpandableNotificationRowDragController controller = createSpyController(); mRow.setDragController(controller); mRow.setHeadsUp(true); mRow.setPinnedStatus(PinnedStatus.PinnedBySystem); // Simulate a failure to initiate drag and drop doReturn(false).when(mRow).startDragAndDrop(any(), any(), any(), anyInt()); mRow.doLongClickCallback(0, 0); mRow.doDragCallback(0, 0); // Verify that we've reset the listener verify(mRow).setOnDragListener(null); } private ExpandableNotificationRowDragController createSpyController() { return spy(mController); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragController.java +7 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ public class ExpandableNotificationRowDragController { boolean result = view.startDragAndDrop(dragData, myShadow, null, View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_REQUEST_SURFACE_FOR_RETURN_ANIMATION); if (result) { Log.d(TAG, "Starting drag from notification view=" + view); // Log notification drag only if it succeeds if (NotificationBundleUi.isEnabled()) { mNotificationPanelLogger.logNotificationDrag(enr.getEntryAdapter()); Loading @@ -156,6 +157,9 @@ public class ExpandableNotificationRowDragController { } else { dismissShade(); } } else { Log.w(TAG, "Failed to starting drag from notification view=" + view); view.setOnDragListener(null); } } Loading Loading @@ -255,6 +259,9 @@ public class ExpandableNotificationRowDragController { } private void cleanUpSurface() { if (!dragSurface.isValid()) { return; } tx.remove(dragSurface); tx.apply(); tx.close(); Loading