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

Commit 63fa8e9d authored by Merissa Mitchell's avatar Merissa Mitchell
Browse files

[WindowDecor] Skip hover animation if task is not in focus.

This CL makes it so that if the task is not in focus (on top), hovering
over the maximize button will not show the hover animation, which in
turn will not show the maximize menu at the end of the animation.
However, clicking the maximize menu should still bring the task to
front and maximize the task.
In addition, if we get a relayout call while the hover is in progress
but the task has lost focus, we explicitly cancel the hover, since we
don't get a HOVER_EXIT signal if a new task launching on top blocks the
hover.

The implementation uses the taskInfo's isFocused rather than the global
focus because the former is per-display, so hovering over the top task
in each display should still show the hover animation and maximize menu.

Bug: 394939272
Test: atest DesktopModeWindowDecorationTests
Flag: EXEMPT bug fix
Change-Id: Ibbfe821f79e6843696757d1acf39457cb19dafc7
parent 72ee52c0
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -469,6 +469,14 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
            }
        }

        // If we get a relayout call while hovering over maximize button in the app header but the
        // task has lost focus, explicitly cancel the hover (since we don't get a HOVER_EXIT signal
        // in this case).
        if (!taskInfo.isFocused && mIsAppHeaderMaximizeButtonHovered) {
            setAppHeaderMaximizeButtonHovered(false);
            onMaximizeButtonHoverExit();
        }

        if (isHandleMenuActive()) {
            mHandleMenu.relayout(
                    startT,
@@ -2010,6 +2018,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
     */
    @Override
    public void onMaximizeButtonHoverEnter() {
        if (!mTaskInfo.isFocused) return;
        asAppHeader(mWindowDecorViewHolder).onMaximizeWindowHoverEnter();
    }

+8 −0
Original line number Diff line number Diff line
@@ -201,6 +201,14 @@ class AppHeaderController(
            traceTag = Trace.TRACE_TAG_WINDOW_MANAGER,
            name = "AppHeaderController#relayout",
        ) {
            // If we get a relayout call while hovering over maximize button in the app header but
            // the task has lost focus, explicitly cancel the hover (since we don't get a HOVER_EXIT
            // signal in this case).
            if (!taskInfo.isFocused && isAppHeaderMaximizeButtonHovered) {
                setAppHeaderMaximizeButtonHovered(hovered = false)
                onMaximizeButtonHoverExit()
            }

            val captionLayout =
                super.relayout(
                    params,
+1 −0
Original line number Diff line number Diff line
@@ -710,6 +710,7 @@ class AppHeaderViewHolder(
    }

    fun onMaximizeWindowHoverEnter() {
        if (!currentTaskInfo.isFocused) return
        maximizeButtonView.startHoverAnimation()
    }