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

Commit 3a2b99be authored by Jorge Gil's avatar Jorge Gil
Browse files

Set task surface crop to null when in fullscreen mode

Even though the task width & height is correct, setting the window crop
to that instead of null causes input events in some regions of the task
surface to not be sent to the app window.

Bug: 300324920
Test: with desktop windowing enabled, launch YT in fullscreen, verify
touch (e.g. scrolling) works on all parts of the window.

Change-Id: I908debc8d457625b447289913dedc62d4559b3b5
parent ae1a8fdf
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.windowdecor;

import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;

import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context;
@@ -223,6 +224,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>

        final Resources resources = mDecorWindowContext.getResources();
        final Rect taskBounds = taskConfig.windowConfiguration.getBounds();
        final boolean isFullscreen = taskConfig.windowConfiguration.getWindowingMode()
                == WINDOWING_MODE_FULLSCREEN;
        outResult.mWidth = taskBounds.width();
        outResult.mHeight = taskBounds.height();

@@ -282,13 +285,24 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
        mTmpColor[1] = (float) Color.green(backgroundColorInt) / 255.f;
        mTmpColor[2] = (float) Color.blue(backgroundColorInt) / 255.f;
        final Point taskPosition = mTaskInfo.positionInParent;
        startT.setWindowCrop(mTaskSurface, outResult.mWidth, outResult.mHeight)
                .setShadowRadius(mTaskSurface, shadowRadius)
        if (isFullscreen) {
            // Setting the task crop to the width/height stops input events from being sent to
            // some regions of the app window. See b/300324920
            // TODO(b/296921174): investigate whether crop/position needs to be set by window
            // decorations at all when transition handlers are already taking ownership of the task
            // surface placement/crop, especially when in fullscreen where tasks cannot be
            // drag-resized by the window decoration.
            startT.setWindowCrop(mTaskSurface, null);
            finishT.setWindowCrop(mTaskSurface, null);
        } else {
            startT.setWindowCrop(mTaskSurface, outResult.mWidth, outResult.mHeight);
            finishT.setWindowCrop(mTaskSurface, outResult.mWidth, outResult.mHeight);
        }
        startT.setShadowRadius(mTaskSurface, shadowRadius)
                .setColor(mTaskSurface, mTmpColor)
                .show(mTaskSurface);
        finishT.setPosition(mTaskSurface, taskPosition.x, taskPosition.y)
                .setShadowRadius(mTaskSurface, shadowRadius)
                .setWindowCrop(mTaskSurface, outResult.mWidth, outResult.mHeight);
                .setShadowRadius(mTaskSurface, shadowRadius);
        if (mTaskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) {
            startT.setCornerRadius(mTaskSurface, params.mCornerRadius);
            finishT.setCornerRadius(mTaskSurface, params.mCornerRadius);