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

Commit a882aef5 authored by Jorge Gil's avatar Jorge Gil
Browse files

Add missing WindowDecorationWrapper impls for default case

Even though #updateHoverAndPressStatus and #checkTouchEvent are
essentially no-op even in DesktopModeWindowDecoration, the ViewModel
still invokes the functions on the wrapper, so the
DefaultWindowDecoration needs an implementation or it will result in an
IllegalStateException.

This changes just adds a no-op branch when default window decor is used
given that the ENABLE_HANDLE_INPUT_FIX flag can be assumed to be always
enabled.

Flag: com.android.window.flags.enable_window_decoration_refactor
Bug: 409648813
Test: touch app handle, no crash
Change-Id: I7286643e1736db27945abc9b92007040dcf4d77f
parent 18fe3c74
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -408,8 +408,9 @@ class WindowDecorationWrapper private constructor(
    fun updateHoverAndPressStatus(
        e: MotionEvent
    ) = when {
        defaultWindowDecor != null -> {} // No-op
        desktopWindowDecor != null -> requireDesktopWindowDecor().updateHoverAndPressStatus(e)
        else -> error("Expected Non-null desktop window decoration")
        else -> error("Expected Non-null default or desktop window decoration")
    }

    /** Handles a interruption to a drag event. */
@@ -548,8 +549,9 @@ class WindowDecorationWrapper private constructor(
    fun checkTouchEvent(
        e: MotionEvent
    ) = when {
        defaultWindowDecor != null -> {} // No-op
        desktopWindowDecor != null -> requireDesktopWindowDecor().checkTouchEvent(e)
        else -> error("Expected Non-null desktop window decoration")
        else -> error("Expected Non-null default or desktop window decoration")
    }

    /**