Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b0e8ff4 authored by Qijing Yao's avatar Qijing Yao
Browse files

Clear indicator surfaces on drag end for same-display drags

Using DragPositioningCallbackUtility for same-display drag bounds
(I6797e11536) prevented the MultiDisplayDragMoveIndicatorController from
properly clearing indicator surfaces on drag end. This caused potential
surface leaks when drags started and ended on the same display but
traversed other displays.

This change ensures that onDragEnd() is always called on the indicator
controller, guaranteeing that all surfaces are properly disposed of.

Bug: 401464337
Test: Manual; atest
Flag: com.android.window.flags.enable_connected_displays_window_drag
Change-Id: Iebfc4d1b017be695d6d5bbb8ef61670c276eefe9
parent 4f06c68f
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -278,12 +278,15 @@ class MultiDisplayVeiledResizeTaskPositioner(
                        currentDisplayLayout,
                    )
                )
            }

            // Call the MultiDisplayDragMoveIndicatorController to clear any active indicator
            // surfaces. This is necessary even if the drag ended on the same display, as surfaces
            // may have been created for other displays during the drag.
            multiDisplayDragMoveIndicatorController.onDragEnd(
                desktopWindowDecoration.mTaskInfo.taskId,
                transactionSupplier,
            )
            }

            interactionJankMonitor.end(Cuj.CUJ_DESKTOP_MODE_DRAG_WINDOW)
        }
+6 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import org.mockito.Mockito.mock
import org.mockito.Mockito.never
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoInteractions
import org.mockito.Mockito.`when`
import org.mockito.Mockito.`when` as whenever
import org.mockito.MockitoAnnotations
@@ -210,6 +211,7 @@ class MultiDisplayVeiledResizeTaskPositionerTest : ShellTestCase() {
                eq(taskPositioner),
            )
        verify(mockDesktopWindowDecoration, never()).hideResizeVeil()
        verifyNoInteractions(mockMultiDisplayDragMoveIndicatorController)
    }

    @Test
@@ -248,6 +250,7 @@ class MultiDisplayVeiledResizeTaskPositionerTest : ShellTestCase() {

        verify(mockDesktopWindowDecoration, never()).showResizeVeil(any())
        verify(mockDesktopWindowDecoration, never()).hideResizeVeil()
        verify(mockMultiDisplayDragMoveIndicatorController).onDragEnd(eq(TASK_ID), any())
        Assert.assertEquals(rectAfterEnd, endBounds)
    }

@@ -268,6 +271,7 @@ class MultiDisplayVeiledResizeTaskPositionerTest : ShellTestCase() {

        verify(spyDisplayLayout0, never()).localPxToGlobalDp(any(), any())
        verify(spyDisplayLayout0, never()).globalDpToLocalPx(any(), any())
        verify(mockMultiDisplayDragMoveIndicatorController).onDragEnd(eq(TASK_ID), any())
    }

    @Test
@@ -290,6 +294,7 @@ class MultiDisplayVeiledResizeTaskPositionerTest : ShellTestCase() {

        verify(mockDesktopWindowDecoration, never()).showResizeVeil(any())
        verify(mockDesktopWindowDecoration, never()).hideResizeVeil()
        verify(mockMultiDisplayDragMoveIndicatorController).onDragEnd(eq(TASK_ID), any())
        Assert.assertEquals(rectAfterEnd, endBounds)
    }

@@ -346,6 +351,7 @@ class MultiDisplayVeiledResizeTaskPositionerTest : ShellTestCase() {
                },
                eq(taskPositioner),
            )
        verifyNoInteractions(mockMultiDisplayDragMoveIndicatorController)
    }

    @Test