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

Commit 3b265801 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Use stack bounds to determine input bounds for window.

We were previously using the task bounds to determine the input
bounds for the window. This doesn't work for the case where the
docked stack is next to a non-resizeable activity/task. In this
case the task is still fullscreen, but the window surface is
cropped to the stack size which isn't fullscreen since the docked
stack is up. By using the stack bounds the input region matches
what is displayed on screen.

Change-Id: Ia4d2b3a7a050eff38d651e511f5822c4428e137d
parent 1e3523c7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -415,7 +415,7 @@ class DragState {
                continue;
            }

            child.getTaskBounds(mTmpRect, !BOUNDS_FOR_TOUCH);
            child.getStackBounds(mTmpRect, !BOUNDS_FOR_TOUCH);
            if (!mTmpRect.contains(x, y)) {
                // outside of this window's activity stack == don't tell about drags
                continue;
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
        if (modal && child.mAppToken != null) {
            // Limit the outer touch to the activity stack region.
            flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
            child.getTaskBounds(mTmpRect, BOUNDS_FOR_TOUCH);
            child.getStackBounds(mTmpRect, BOUNDS_FOR_TOUCH);
            inputWindowHandle.touchableRegion.set(mTmpRect);
        } else {
            // Not modal or full screen modal
+1 −1
Original line number Diff line number Diff line
@@ -5634,7 +5634,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        int right = wf.right - cr.right;
                        int bottom = wf.bottom - cr.bottom;
                        frame.union(left, top, right, bottom);
                        ws.getTaskBounds(stackBounds, !BOUNDS_FOR_TOUCH);
                        ws.getStackBounds(stackBounds, !BOUNDS_FOR_TOUCH);
                        if (!frame.intersect(stackBounds)) {
                            // Set frame empty if there's no intersection.
                            frame.setEmpty();
+7 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

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;
@@ -934,17 +935,17 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    }

    /**
     * Retrieves the bounds for a task.
     * Retrieves the bounds of the window stack.
     * @param bounds The rect which gets the bounds.
     * @param forTouch Pass in BOUNDS_FOR_TOUCH to get touch related bounds, otherwise visible
     *        bounds will be returned.
     */
    void getTaskBounds(Rect bounds, boolean forTouch) {
        final Task task = getTask();
        if (task != null) {
            task.getBounds(bounds);
    void getStackBounds(Rect bounds, boolean forTouch) {
        final TaskStack stack = getStack();
        if (stack != null) {
            stack.getBounds(bounds);
            if (forTouch == BOUNDS_FOR_TOUCH) {
                if (task.inFreeformWorkspace()) {
                if (stack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
                    final DisplayMetrics displayMetrics = getDisplayContent().getDisplayMetrics();
                    final int delta =
                            mService.dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP, displayMetrics);