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

Commit a93aeaf7 authored by Merissa Mitchell's avatar Merissa Mitchell
Browse files

[WindowDecor2] Fix containerSurfaceChanged check

This CL fixes a bug in WindowDecor2 where the containerSurfaceChanged in
DefaultWindowDecoration is not correctly checking the difference between
the decorationContainerSurface before and after relayout. This was
causing the DragResizeInputListener to not be recreated as needed when
the task is minimized then restored.

Fixes: 437193997
Test: Manual - minimize and restore the task then verify that
drag-to-resize is WAI
Test: atest WMShellUnitTests:com.android.wm.shell.windowdecor
Flag: EXEMPT bugfix

Change-Id: I685e1c9cbdc3cb06907ecf6d85897c1ee8624ec3
parent 56acfa37
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -360,6 +360,7 @@ constructor(
                )

            val wct = windowContainerTransactionSupplier.invoke()
            val oldDecorationSurface = decorationContainerSurface
            relayout(relayoutParams, startT, finishT, wct, taskSurface)

            // After this line, [WindowDecoration2.taskInfo] is up-to-date and should be
@@ -389,7 +390,9 @@ constructor(
                Trace.endSection()
            }

            decorationContainerSurface?.let { updateDragResizeListenerIfNeeded(it) }
            decorationContainerSurface?.let {
                updateDragResizeListenerIfNeeded(oldDecorationSurface)
            }
        }

    private fun getRelayoutParams(
@@ -653,7 +656,7 @@ constructor(
        return showCaption
    }

    private fun updateDragResizeListenerIfNeeded(containerSurface: SurfaceControl) {
    private fun updateDragResizeListenerIfNeeded(containerSurface: SurfaceControl?) {
        val taskPositionChanged = !taskInfo.positionInParent.equals(taskPositionInParent)
        if (!taskInfo.isDragResizable(inFullImmersive)) {
            if (taskPositionChanged) {
@@ -671,7 +674,7 @@ constructor(
    }

    private fun updateDragResizeListener(
        containerSurface: SurfaceControl,
        containerSurface: SurfaceControl?,
        onUpdateFinished: (Boolean) -> Unit,
    ) {
        val containerSurfaceChanged = containerSurface != decorationContainerSurface
@@ -693,7 +696,7 @@ constructor(
                    handler,
                    choreographer,
                    checkNotNull(display?.displayId) { "expected non-null display" },
                    decorationContainerSurface,
                    checkNotNull(decorationContainerSurface),
                    dragPositioningCallback,
                    surfaceControlBuilderSupplier,
                    surfaceControlTransactionSupplier,