Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipDisplayTransferHandler.java +0 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,6 @@ public class PipDisplayTransferHandler implements /** * Remove all drag indicator mirrors from each connected display. */ // TODO(b/408981327): Remove mirrors on screen lock // TODO(b/408982524): Remove mirrors on opening app while dragging public void removeMirrors() { final Transaction transaction = mSurfaceControlTransactionFactory.getTransaction(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTouchHandler.java +3 −0 Original line number Diff line number Diff line Loading @@ -609,6 +609,9 @@ public class PipTouchHandler implements PipTransitionState.PipTransitionStateCha } // Fall through to clean up case MotionEvent.ACTION_CANCEL: { if (mPipDesktopState.isDraggingPipAcrossDisplaysEnabled()) { mPipDisplayTransferHandler.removeMirrors(); } shouldDeliverToMenu = !mTouchState.startedDragging() && !mTouchState.isDragging(); mTouchState.reset(); break; Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip2/phone/PipTouchHandlerTest.kt +35 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.testing.TestableLooper.RunWithLooper import android.view.InputDevice.SOURCE_MOUSE import android.view.InputDevice.SOURCE_TOUCHSCREEN import android.view.MotionEvent import android.view.MotionEvent.ACTION_CANCEL import android.view.SurfaceControl import androidx.test.filters.SmallTest import com.android.dx.mockito.inline.extended.ExtendedMockito Loading Loading @@ -50,6 +51,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyInt import org.mockito.kotlin.any import org.mockito.kotlin.doNothing import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.never Loading Loading @@ -91,6 +93,7 @@ class PipTouchHandlerTest : ShellTestCase() { private val mockPipSurfaceTransactionHelper = mock<PipSurfaceTransactionHelper>() private val mockMotionEvent = mock<MotionEvent>() private val mockPipDismissTargetHandler = mock<PipDismissTargetHandler>() private val mockPipResizeGestureHandler = mock<PipResizeGestureHandler>() private lateinit var pipTouchHandler: PipTouchHandler private lateinit var pipTouchGesture: PipTouchGesture Loading @@ -115,6 +118,7 @@ class PipTouchHandlerTest : ShellTestCase() { pipTouchGesture = pipTouchHandler.touchGesture pipTouchHandler.setPipTouchState(pipTouchState) pipTouchHandler.setPipDismissTargetHandler(mockPipDismissTargetHandler) pipTouchHandler.pipResizeGestureHandler = mockPipResizeGestureHandler whenever(pipTouchState.downTouchPosition).thenReturn(mockTouchPosition) whenever(pipTouchState.velocity).thenReturn(mockTouchPosition) Loading Loading @@ -259,6 +263,37 @@ class PipTouchHandlerTest : ShellTestCase() { verify(mockPipDismissTargetHandler, never()).showDismissTargetMaybe() } @Test fun handleTouchEvent_crossDisplayDragFlagEnabled_actionCancel_removesMirrors() { whenever(mockPipDesktopState.isDraggingPipAcrossDisplaysEnabled()).thenReturn(true) whenever(pipTouchState.startedDragging()).thenReturn(true) whenever(mockPipResizeGestureHandler.willStartResizeGesture(any())).thenReturn(false) whenever(mockPipResizeGestureHandler.hasOngoingGesture()).thenReturn(false) doNothing().`when`(pipTouchState).onTouchEvent(any()) doNothing().`when`(pipTouchState).reset() whenever(mockMotionEvent.action).thenReturn(ACTION_CANCEL) pipTouchHandler.handleTouchEvent(mockMotionEvent) verify(mockPipDisplayTransferHandler).removeMirrors() } @Test fun handleTouchEvent_crossDisplayDragFlagDisabled_actionCancel_doesNotRemoveMirrors() { whenever(mockPipDesktopState.isDraggingPipAcrossDisplaysEnabled()).thenReturn(false) whenever(pipTouchState.startedDragging()).thenReturn(true) whenever(mockPipResizeGestureHandler.willStartResizeGesture(any())).thenReturn(false) whenever(mockPipResizeGestureHandler.hasOngoingGesture()).thenReturn(false) doNothing().`when`(pipTouchState).onTouchEvent(any()) doNothing().`when`(pipTouchState).reset() whenever(mockMotionEvent.action).thenReturn(ACTION_CANCEL) pipTouchHandler.handleTouchEvent(mockMotionEvent) verify(mockPipDisplayTransferHandler, never()).removeMirrors() } private companion object { const val ORIGIN_DISPLAY_ID = 0 const val TARGET_DISPLAY_ID = 1 Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipDisplayTransferHandler.java +0 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,6 @@ public class PipDisplayTransferHandler implements /** * Remove all drag indicator mirrors from each connected display. */ // TODO(b/408981327): Remove mirrors on screen lock // TODO(b/408982524): Remove mirrors on opening app while dragging public void removeMirrors() { final Transaction transaction = mSurfaceControlTransactionFactory.getTransaction(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTouchHandler.java +3 −0 Original line number Diff line number Diff line Loading @@ -609,6 +609,9 @@ public class PipTouchHandler implements PipTransitionState.PipTransitionStateCha } // Fall through to clean up case MotionEvent.ACTION_CANCEL: { if (mPipDesktopState.isDraggingPipAcrossDisplaysEnabled()) { mPipDisplayTransferHandler.removeMirrors(); } shouldDeliverToMenu = !mTouchState.startedDragging() && !mTouchState.isDragging(); mTouchState.reset(); break; Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip2/phone/PipTouchHandlerTest.kt +35 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.testing.TestableLooper.RunWithLooper import android.view.InputDevice.SOURCE_MOUSE import android.view.InputDevice.SOURCE_TOUCHSCREEN import android.view.MotionEvent import android.view.MotionEvent.ACTION_CANCEL import android.view.SurfaceControl import androidx.test.filters.SmallTest import com.android.dx.mockito.inline.extended.ExtendedMockito Loading Loading @@ -50,6 +51,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyInt import org.mockito.kotlin.any import org.mockito.kotlin.doNothing import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.never Loading Loading @@ -91,6 +93,7 @@ class PipTouchHandlerTest : ShellTestCase() { private val mockPipSurfaceTransactionHelper = mock<PipSurfaceTransactionHelper>() private val mockMotionEvent = mock<MotionEvent>() private val mockPipDismissTargetHandler = mock<PipDismissTargetHandler>() private val mockPipResizeGestureHandler = mock<PipResizeGestureHandler>() private lateinit var pipTouchHandler: PipTouchHandler private lateinit var pipTouchGesture: PipTouchGesture Loading @@ -115,6 +118,7 @@ class PipTouchHandlerTest : ShellTestCase() { pipTouchGesture = pipTouchHandler.touchGesture pipTouchHandler.setPipTouchState(pipTouchState) pipTouchHandler.setPipDismissTargetHandler(mockPipDismissTargetHandler) pipTouchHandler.pipResizeGestureHandler = mockPipResizeGestureHandler whenever(pipTouchState.downTouchPosition).thenReturn(mockTouchPosition) whenever(pipTouchState.velocity).thenReturn(mockTouchPosition) Loading Loading @@ -259,6 +263,37 @@ class PipTouchHandlerTest : ShellTestCase() { verify(mockPipDismissTargetHandler, never()).showDismissTargetMaybe() } @Test fun handleTouchEvent_crossDisplayDragFlagEnabled_actionCancel_removesMirrors() { whenever(mockPipDesktopState.isDraggingPipAcrossDisplaysEnabled()).thenReturn(true) whenever(pipTouchState.startedDragging()).thenReturn(true) whenever(mockPipResizeGestureHandler.willStartResizeGesture(any())).thenReturn(false) whenever(mockPipResizeGestureHandler.hasOngoingGesture()).thenReturn(false) doNothing().`when`(pipTouchState).onTouchEvent(any()) doNothing().`when`(pipTouchState).reset() whenever(mockMotionEvent.action).thenReturn(ACTION_CANCEL) pipTouchHandler.handleTouchEvent(mockMotionEvent) verify(mockPipDisplayTransferHandler).removeMirrors() } @Test fun handleTouchEvent_crossDisplayDragFlagDisabled_actionCancel_doesNotRemoveMirrors() { whenever(mockPipDesktopState.isDraggingPipAcrossDisplaysEnabled()).thenReturn(false) whenever(pipTouchState.startedDragging()).thenReturn(true) whenever(mockPipResizeGestureHandler.willStartResizeGesture(any())).thenReturn(false) whenever(mockPipResizeGestureHandler.hasOngoingGesture()).thenReturn(false) doNothing().`when`(pipTouchState).onTouchEvent(any()) doNothing().`when`(pipTouchState).reset() whenever(mockMotionEvent.action).thenReturn(ACTION_CANCEL) pipTouchHandler.handleTouchEvent(mockMotionEvent) verify(mockPipDisplayTransferHandler, never()).removeMirrors() } private companion object { const val ORIGIN_DISPLAY_ID = 0 const val TARGET_DISPLAY_ID = 1 Loading