From 2b19b6046cd7273ddd2818a2fbb8d3f0eaaa623a Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Fri, 18 Sep 2015 15:14:59 -0700 Subject: Don't set input bounds for task to the stack bounds. 3b2658011819cfe1bed61763bb666bde6e919f79 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 --- .../java/com/android/server/wm/WindowState.java | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index fa28eba14603..16347f560e64 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -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; } - } else { - final Task task = getTask(); - if (task != null) { - task.getBounds(bounds); - isFreeform = task.inFreeformWorkspace(); + } + + 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) { -- cgit v1.2.3-59-g8ed1b