summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chong Zhang <chz@google.com> 2015-12-28 15:18:29 -0800
committer Chong Zhang <chz@google.com> 2015-12-29 14:23:16 -0800
commitbd0d937303ae54d8a5bb5f08080c4164302daefc (patch)
treee126feb81e01365875972bd062577abed7f218c0
parent7e5445f2b457fa6bf3b3ea306ca344ab4a648dae (diff)
Notify client when the window is moved because of a resize
We need to notify the client that the window has moved if a resize results in a move without size change. This makes sure that relevent info on client side (such as mAttachInfo.mWindowLeft/Top) gets updated to the new frame. Things like View.getLocationOnScreen() may depend on these to function. Bug: 25565385 Change-Id: I5b9ded0b16243c14494f9a69257d56570ee8996d
-rw-r--r--services/core/java/com/android/server/wm/Task.java15
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java8
-rw-r--r--services/core/java/com/android/server/wm/WindowSurfacePlacer.java1
3 files changed, 20 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 72a834315b5d..27e7a31bd07b 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -285,6 +285,8 @@ class Task implements DimLayer.DimLayerUser {
}
if ((boundsChanged & BOUNDS_CHANGE_SIZE) == BOUNDS_CHANGE_SIZE) {
resizeWindows();
+ } else {
+ moveWindows();
}
return true;
}
@@ -463,13 +465,24 @@ class Task implements DimLayer.DimLayerUser {
for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
final WindowState win = windows.get(winNdx);
if (!resizingWindows.contains(win)) {
- if (DEBUG_RESIZE) Slog.d(TAG_WM, "setBounds: Resizing " + win);
+ if (DEBUG_RESIZE) Slog.d(TAG_WM, "resizeWindows: Resizing " + win);
resizingWindows.add(win);
}
}
}
}
+ void moveWindows() {
+ for (int activityNdx = mAppTokens.size() - 1; activityNdx >= 0; --activityNdx) {
+ final ArrayList<WindowState> windows = mAppTokens.get(activityNdx).allAppWindows;
+ for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
+ final WindowState win = windows.get(winNdx);
+ if (DEBUG_RESIZE) Slog.d(TAG_WM, "moveWindows: Moving " + win);
+ win.mMovedByResize = true;
+ }
+ }
+ }
+
/**
* Cancels any running app transitions associated with the task.
*/
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index c63618527910..733bc2993d90 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -417,6 +417,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
// the window is added and unset when this window reports its first draw.
WindowState mReplacingWindow = null;
+ // Whether this window is being moved via the resize API
+ boolean mMovedByResize;
/**
* Wake lock for drawing.
* Even though it's slightly more expensive to do so, we will use a separate wake lock
@@ -1208,9 +1210,9 @@ final class WindowState implements WindowManagerPolicy.WindowState {
* sense to call from performLayoutAndPlaceSurfacesLockedInner().)
*/
boolean hasMoved() {
- return mHasSurface && mContentChanged && !mExiting && !mWinAnimator.mLastHidden
- && mService.okToDisplay() && (mFrame.top != mLastFrame.top
- || mFrame.left != mLastFrame.left)
+ return mHasSurface && (mContentChanged || mMovedByResize)
+ && !mExiting && !mWinAnimator.mLastHidden && mService.okToDisplay()
+ && (mFrame.top != mLastFrame.top || mFrame.left != mLastFrame.left)
&& (mAttachedWindow == null || !mAttachedWindow.hasMoved());
}
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index cbfb201a529c..6ebda0727165 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -709,6 +709,7 @@ class WindowSurfacePlacer {
//Slog.i(TAG_WM, "Window " + this + " clearing mContentChanged - done placing");
w.mContentChanged = false;
+ w.mMovedByResize = false;
// Moved from updateWindowsAndWallpaperLocked().
if (w.mHasSurface) {