Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/MultiDisplayDragMoveIndicatorController.kt +8 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.graphics.RectF import android.view.SurfaceControl import com.android.wm.shell.RootTaskDisplayAreaOrganizer import com.android.wm.shell.shared.annotations.ShellDesktopThread import com.android.wm.shell.shared.desktopmode.DesktopState /** * Controller to manage the indicators that show users the current position of the dragged window on Loading @@ -30,6 +31,7 @@ class MultiDisplayDragMoveIndicatorController( private val rootTaskDisplayAreaOrganizer: RootTaskDisplayAreaOrganizer, private val indicatorSurfaceFactory: MultiDisplayDragMoveIndicatorSurface.Factory, @ShellDesktopThread private val desktopExecutor: ShellExecutor, private val desktopState: DesktopState, ) { @ShellDesktopThread private val dragIndicators = Loading @@ -55,8 +57,12 @@ class MultiDisplayDragMoveIndicatorController( ) { desktopExecutor.execute { for (displayId in displayIds) { if (displayId == startDisplayId) { // No need to render indicators on the original display where the drag started. if ( displayId == startDisplayId || !desktopState.isDesktopModeSupportedOnDisplay(displayId) ) { // No need to render indicators on the original display where the drag started, // or on displays that do not support desktop mode. continue } val displayLayout = displayController.getDisplayLayout(displayId) ?: continue Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +3 −2 Original line number Diff line number Diff line Loading @@ -1182,11 +1182,12 @@ public abstract class WMShellModule { RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer, MultiDisplayDragMoveIndicatorSurface.Factory multiDisplayDragMoveIndicatorSurfaceFactory, @ShellDesktopThread ShellExecutor desktopExecutor @ShellDesktopThread ShellExecutor desktopExecutor, DesktopState desktopState ) { return new MultiDisplayDragMoveIndicatorController( displayController, rootTaskDisplayAreaOrganizer, multiDisplayDragMoveIndicatorSurfaceFactory, desktopExecutor); multiDisplayDragMoveIndicatorSurfaceFactory, desktopExecutor, desktopState); } @WMSingleton Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/MultiDisplayDragMoveIndicatorControllerTest.kt +21 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.wm.shell.RootTaskDisplayAreaOrganizer import com.android.wm.shell.ShellTestCase import com.android.wm.shell.TestShellExecutor import com.android.wm.shell.common.MultiDisplayTestUtil.TestDisplay import com.android.wm.shell.shared.desktopmode.FakeDesktopState import java.util.function.Supplier import org.junit.Before import org.junit.Test Loading @@ -51,6 +52,8 @@ class MultiDisplayDragMoveIndicatorControllerTest : ShellTestCase() { private val displayController = mock<DisplayController>() private val rootTaskDisplayAreaOrganizer = mock<RootTaskDisplayAreaOrganizer>() private val indicatorSurfaceFactory = mock<MultiDisplayDragMoveIndicatorSurface.Factory>() private val desktopState = FakeDesktopState() private val indicatorSurface0 = mock<MultiDisplayDragMoveIndicatorSurface>() private val indicatorSurface1 = mock<MultiDisplayDragMoveIndicatorSurface>() private val transaction = mock<SurfaceControl.Transaction>() Loading @@ -77,6 +80,7 @@ class MultiDisplayDragMoveIndicatorControllerTest : ShellTestCase() { rootTaskDisplayAreaOrganizer, indicatorSurfaceFactory, executor, desktopState, ) val spyDisplayLayout0 = TestDisplay.DISPLAY_0.getSpyDisplayLayout(resources.resources) Loading @@ -91,6 +95,7 @@ class MultiDisplayDragMoveIndicatorControllerTest : ShellTestCase() { whenever(indicatorSurfaceFactory.create(eq(taskInfo), eq(display0), any())).thenReturn(indicatorSurface0) whenever(indicatorSurfaceFactory.create(eq(taskInfo), eq(display1), any())).thenReturn(indicatorSurface1) whenever(transactionSupplier.get()).thenReturn(transaction) desktopState.canEnterDesktopMode = true } @Test Loading Loading @@ -121,6 +126,22 @@ class MultiDisplayDragMoveIndicatorControllerTest : ShellTestCase() { verify(indicatorSurfaceFactory, never()).create(any(), any(), any()) } @Test fun onDrag_boundsIntersectWithDesktopModeUnsupportedDisplay_noIndicator() { desktopState.overrideDesktopModeSupportPerDisplay[1] = false controller.onDragMove( RectF(100f, -100f, 200f, 200f), // intersect with display 0 and 1 currentDisplayId = 1, startDisplayId = 0, taskInfo, displayIds = setOf(0, 1), ) { transaction } executor.flushAll() verify(indicatorSurfaceFactory, never()).create(any(), any(), any()) } @Test fun onDrag_boundsIntersectWithNonStartDisplay_showAndDisposeIndicator() { controller.onDragMove( Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/MultiDisplayDragMoveIndicatorController.kt +8 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.graphics.RectF import android.view.SurfaceControl import com.android.wm.shell.RootTaskDisplayAreaOrganizer import com.android.wm.shell.shared.annotations.ShellDesktopThread import com.android.wm.shell.shared.desktopmode.DesktopState /** * Controller to manage the indicators that show users the current position of the dragged window on Loading @@ -30,6 +31,7 @@ class MultiDisplayDragMoveIndicatorController( private val rootTaskDisplayAreaOrganizer: RootTaskDisplayAreaOrganizer, private val indicatorSurfaceFactory: MultiDisplayDragMoveIndicatorSurface.Factory, @ShellDesktopThread private val desktopExecutor: ShellExecutor, private val desktopState: DesktopState, ) { @ShellDesktopThread private val dragIndicators = Loading @@ -55,8 +57,12 @@ class MultiDisplayDragMoveIndicatorController( ) { desktopExecutor.execute { for (displayId in displayIds) { if (displayId == startDisplayId) { // No need to render indicators on the original display where the drag started. if ( displayId == startDisplayId || !desktopState.isDesktopModeSupportedOnDisplay(displayId) ) { // No need to render indicators on the original display where the drag started, // or on displays that do not support desktop mode. continue } val displayLayout = displayController.getDisplayLayout(displayId) ?: continue Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +3 −2 Original line number Diff line number Diff line Loading @@ -1182,11 +1182,12 @@ public abstract class WMShellModule { RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer, MultiDisplayDragMoveIndicatorSurface.Factory multiDisplayDragMoveIndicatorSurfaceFactory, @ShellDesktopThread ShellExecutor desktopExecutor @ShellDesktopThread ShellExecutor desktopExecutor, DesktopState desktopState ) { return new MultiDisplayDragMoveIndicatorController( displayController, rootTaskDisplayAreaOrganizer, multiDisplayDragMoveIndicatorSurfaceFactory, desktopExecutor); multiDisplayDragMoveIndicatorSurfaceFactory, desktopExecutor, desktopState); } @WMSingleton Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/MultiDisplayDragMoveIndicatorControllerTest.kt +21 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.wm.shell.RootTaskDisplayAreaOrganizer import com.android.wm.shell.ShellTestCase import com.android.wm.shell.TestShellExecutor import com.android.wm.shell.common.MultiDisplayTestUtil.TestDisplay import com.android.wm.shell.shared.desktopmode.FakeDesktopState import java.util.function.Supplier import org.junit.Before import org.junit.Test Loading @@ -51,6 +52,8 @@ class MultiDisplayDragMoveIndicatorControllerTest : ShellTestCase() { private val displayController = mock<DisplayController>() private val rootTaskDisplayAreaOrganizer = mock<RootTaskDisplayAreaOrganizer>() private val indicatorSurfaceFactory = mock<MultiDisplayDragMoveIndicatorSurface.Factory>() private val desktopState = FakeDesktopState() private val indicatorSurface0 = mock<MultiDisplayDragMoveIndicatorSurface>() private val indicatorSurface1 = mock<MultiDisplayDragMoveIndicatorSurface>() private val transaction = mock<SurfaceControl.Transaction>() Loading @@ -77,6 +80,7 @@ class MultiDisplayDragMoveIndicatorControllerTest : ShellTestCase() { rootTaskDisplayAreaOrganizer, indicatorSurfaceFactory, executor, desktopState, ) val spyDisplayLayout0 = TestDisplay.DISPLAY_0.getSpyDisplayLayout(resources.resources) Loading @@ -91,6 +95,7 @@ class MultiDisplayDragMoveIndicatorControllerTest : ShellTestCase() { whenever(indicatorSurfaceFactory.create(eq(taskInfo), eq(display0), any())).thenReturn(indicatorSurface0) whenever(indicatorSurfaceFactory.create(eq(taskInfo), eq(display1), any())).thenReturn(indicatorSurface1) whenever(transactionSupplier.get()).thenReturn(transaction) desktopState.canEnterDesktopMode = true } @Test Loading Loading @@ -121,6 +126,22 @@ class MultiDisplayDragMoveIndicatorControllerTest : ShellTestCase() { verify(indicatorSurfaceFactory, never()).create(any(), any(), any()) } @Test fun onDrag_boundsIntersectWithDesktopModeUnsupportedDisplay_noIndicator() { desktopState.overrideDesktopModeSupportPerDisplay[1] = false controller.onDragMove( RectF(100f, -100f, 200f, 200f), // intersect with display 0 and 1 currentDisplayId = 1, startDisplayId = 0, taskInfo, displayIds = setOf(0, 1), ) { transaction } executor.flushAll() verify(indicatorSurfaceFactory, never()).create(any(), any(), any()) } @Test fun onDrag_boundsIntersectWithNonStartDisplay_showAndDisposeIndicator() { controller.onDragMove( Loading