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

Commit 2b19b604 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Don't set input bounds for task to the stack bounds.

3b265801 tried to fix a
problem where the task could be dragged outside its stack
bounds. However, the input bounds was been set to the
entire stack bounds which prevented input from going to
other tasks in the stack.
We now intersect with the stack bounds.

Bug: 24201913
Change-Id: Ibb84bc099b6709ceb865f114b5e9857c5ab2ef1a
parent 153a2930
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm;

import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
@@ -382,6 +381,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
     */
    PowerManager.WakeLock mDrawLock;

    final private Rect mTmpRect = new Rect();

    WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
           WindowState attachedWindow, int appOp, int seq, WindowManager.LayoutParams a,
           int viewVisibility, final DisplayContent displayContent) {
@@ -937,24 +938,33 @@ final class WindowState implements WindowManagerPolicy.WindowState {
     *        bounds will be returned.
     */
    void getVisibleBounds(Rect bounds, boolean forTouch) {
        final boolean useStackBounds = mAppToken != null && mAppToken.mCropWindowsToStack;
        boolean intersectWithStackBounds = mAppToken != null && mAppToken.mCropWindowsToStack;
        boolean isFreeform = false;
        bounds.setEmpty();
        if (useStackBounds) {
        mTmpRect.setEmpty();
        if (intersectWithStackBounds) {
            final TaskStack stack = getStack();
            if (stack != null) {
                stack.getBounds(bounds);
                isFreeform = stack.mStackId == FREEFORM_WORKSPACE_STACK_ID;
            }
                stack.getBounds(mTmpRect);
            } else {
                intersectWithStackBounds = false;
            }
        }

        final Task task = getTask();
        if (task != null) {
            task.getBounds(bounds);
            isFreeform = task.inFreeformWorkspace();
            if (intersectWithStackBounds) {
                bounds.intersect(mTmpRect);
            }
        }

        if (bounds.isEmpty()) {
            bounds.set(mFrame);
            if (intersectWithStackBounds) {
                bounds.intersect(mTmpRect);
            }
            return;
        }
        if (forTouch && isFreeform) {