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

Commit d18097bc authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Use visible window bounds to determine if a point is within a task"

parents a42521ca 12cbd92c
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -266,12 +266,19 @@ class DisplayContent {
            final ArrayList<Task> tasks = mStacks.get(stackNdx).getTasks();
            for (int taskNdx = tasks.size() - 1; taskNdx >= 0; --taskNdx) {
                final Task task = tasks.get(taskNdx);
                task.getBounds(mTmpRect);
                // We need to use the visible frame on the window for any touch-related tests.
                // Can't use the task's bounds because the original task bounds might be adjusted
                // to fit the content frame. For example, the presence of the IME adjusting the
                // windows frames when the app window is the IME target.
                final WindowState win = task.getTopAppMainWindow();
                if (win != null) {
                    win.getVisibleBounds(mTmpRect, !BOUNDS_FOR_TOUCH);
                    if (mTmpRect.contains(x, y)) {
                        return task.mTaskId;
                    }
                }
            }
        }
        return -1;
    }

@@ -298,7 +305,7 @@ class DisplayContent {
                // might be adjusted to fit the content frame. (One example is when the
                // task is put to top-left quadrant, the actual visible frame would not
                // start at (0,0) after it's adjusted for the status bar.)
                WindowState win = task.getTopAppMainWindow();
                final WindowState win = task.getTopAppMainWindow();
                if (win != null) {
                    win.getVisibleBounds(mTmpRect, !BOUNDS_FOR_TOUCH);
                    mTmpRect.inset(-delta, -delta);