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

Commit 42dca159 authored by Qijing Yao's avatar Qijing Yao Committed by Android (Google) Code Review
Browse files

Merge changes I714235c4,I2aab4219 into main

* changes:
  Make sure stableBounds during drag up-to-date
  Add flag for resetting stable bounds when drag end
parents 239caf34 a26d2e2c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@ public enum DesktopExperienceFlags {
            Flags.FLAG_ENABLE_DISPLAY_WINDOWING_MODE_SWITCHING),
    ENABLE_DRAGGING_PIP_ACROSS_DISPLAYS(Flags::enableDraggingPipAcrossDisplays, false,
            Flags.FLAG_ENABLE_DRAGGING_PIP_ACROSS_DISPLAYS),
    ENABLE_DRAG_END_STABLE_BOUNDS_RESET(Flags::enableDragEndStableBoundsReset, false,
            Flags.FLAG_ENABLE_DRAG_END_STABLE_BOUNDS_RESET),
    ENABLE_DRAG_TO_MAXIMIZE(Flags::enableDragToMaximize, true, Flags.FLAG_ENABLE_DRAG_TO_MAXIMIZE),
    ENABLE_DYNAMIC_RADIUS_COMPUTATION_BUGFIX(Flags::enableDynamicRadiusComputationBugfix, true,
            Flags.FLAG_ENABLE_DYNAMIC_RADIUS_COMPUTATION_BUGFIX),
+10 −0
Original line number Diff line number Diff line
@@ -820,6 +820,16 @@ flag {
    bug: "374849026"
}

flag {
    name: "enable_drag_end_stable_bounds_reset"
    namespace: "lse_desktop_experience"
    description: "Enables bugfix handling stale stable bounds when drag ends."
    bug: "421180735"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "enable_drag_resize_set_up_in_bg_thread"
    namespace: "lse_desktop_experience"
+8 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.view.Choreographer
import android.view.Surface
import android.view.SurfaceControl
import android.view.WindowManager
import android.window.DesktopExperienceFlags
import android.window.TransitionInfo
import android.window.TransitionRequestInfo
import android.window.WindowContainerTransaction
@@ -281,6 +282,13 @@ class MultiDisplayVeiledResizeTaskPositioner(
                        currentDisplayLayout,
                    )
                )

                if (
                    DesktopExperienceFlags.ENABLE_DRAG_END_STABLE_BOUNDS_RESET.isTrue &&
                        displayId != startDisplayId
                ) {
                    currentDisplayLayout.getStableBounds(stableBounds)
                }
            }

            // Call the MultiDisplayDragMoveIndicatorController to clear any active indicator
+24 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.Rect
import android.os.Handler
import android.os.IBinder
import android.os.Looper
import android.platform.test.annotations.EnableFlags
import android.testing.AndroidTestingRunner
import android.testing.TestableResources
import android.view.Display
@@ -37,6 +38,7 @@ import android.window.WindowContainerToken
import androidx.test.filters.SmallTest
import androidx.test.internal.runner.junit4.statement.UiThreadStatement.runOnUiThread
import com.android.internal.jank.InteractionJankMonitor
import com.android.window.flags.Flags
import com.android.wm.shell.ShellTaskOrganizer
import com.android.wm.shell.ShellTestCase
import com.android.wm.shell.common.DisplayController
@@ -592,6 +594,28 @@ class MultiDisplayVeiledResizeTaskPositionerTest : ShellTestCase() {
        verify(spyDisplayLayout0, times(2)).getStableBounds(any())
    }

    @Test
    @EnableFlags(Flags.FLAG_ENABLE_DRAG_END_STABLE_BOUNDS_RESET)
    fun testDragResize_displayHasChanged_refetchStableBounds() = runOnUiThread {
        // Start drag on display 0
        taskPositioner.onDragPositioningStart(
            CTRL_TYPE_UNDEFINED,
            DISPLAY_ID_0,
            STARTING_BOUNDS.left.toFloat(),
            STARTING_BOUNDS.top.toFloat(),
        )

        // First drag; we should fetch stable bounds for display 0.
        verify(spyDisplayLayout0, times(1)).getStableBounds(any())

        // End drag on display 1
        taskPositioner.onDragPositioningEnd(DISPLAY_ID_1, 200f, 800f)
        mockWindowDecoration.taskInfo.apply { displayId = DISPLAY_ID_1 }

        // Display has changed; we expect a new stable bounds for display 1.
        verify(spyDisplayLayout1, times(1)).getStableBounds(any())
    }

    @Test
    fun testClose() = runOnUiThread {
        verify(mockDisplayController, times(1)).addDisplayWindowListener(eq(taskPositioner))