Minor refactors.
- Refactor DragState to take Display instead of DisplayContent.
- Rename xxxAnimationLw methods in WindowManagerPolicy to xxxPostLayout
to reflect animation refactoring.
Change-Id: I502f2aa45a699ad395a249a12abf9843294623f0
diff --git a/services/java/com/android/server/wm/DisplayContent.java b/services/java/com/android/server/wm/DisplayContent.java
index 6e5bbcb..1e1b097 100644
--- a/services/java/com/android/server/wm/DisplayContent.java
+++ b/services/java/com/android/server/wm/DisplayContent.java
@@ -62,6 +62,9 @@
final DisplayInfo mDisplayInfo = new DisplayInfo();
final Display mDisplay;
+ // Accessed directly by all users.
+ boolean layoutNeeded;
+
DisplayContent(Display display) {
mDisplay = display;
mDisplayId = display.getDisplayId();
@@ -106,6 +109,7 @@
pw.print("x"); pw.print(mDisplayInfo.smallestNominalAppHeight);
pw.print("-"); pw.print(mDisplayInfo.largestNominalAppWidth);
pw.print("x"); pw.println(mDisplayInfo.largestNominalAppHeight);
+ pw.print("layoutNeeded="); pw.println(layoutNeeded);
pw.println();
}
}
diff --git a/services/java/com/android/server/wm/DragState.java b/services/java/com/android/server/wm/DragState.java
index 3fcf680..dc52fcf 100644
--- a/services/java/com/android/server/wm/DragState.java
+++ b/services/java/com/android/server/wm/DragState.java
@@ -23,13 +23,14 @@
import android.content.ClipData;
import android.content.ClipDescription;
+import android.graphics.Point;
import android.graphics.Region;
import android.os.IBinder;
import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.util.Slog;
-import android.view.DisplayInfo;
+import android.view.Display;
import android.view.DragEvent;
import android.view.InputChannel;
import android.view.Surface;
@@ -59,7 +60,7 @@
WindowState mTargetWindow;
ArrayList<WindowState> mNotifiedWindows;
boolean mDragInProgress;
- DisplayContent mDisplayContent;
+ Display mDisplay;
private final Region mTmpRegion = new Region();
@@ -87,10 +88,10 @@
}
/**
- * @param displayContent The display parameters associated with the window being dragged.
+ * @param display The Display that the window being dragged is on.
*/
- void register(DisplayContent displayContent) {
- mDisplayContent = displayContent;
+ void register(Display display) {
+ mDisplay = display;
if (WindowManagerService.DEBUG_DRAG) Slog.d(WindowManagerService.TAG, "registering drag input channel");
if (mClientChannel != null) {
Slog.e(WindowManagerService.TAG, "Duplicate register of drag input channel");
@@ -108,7 +109,7 @@
WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null,
- mDisplayContent.getDisplayId());
+ mDisplay.getDisplayId());
mDragWindowHandle.name = "drag";
mDragWindowHandle.inputChannel = mServerChannel;
mDragWindowHandle.layer = getDragLayerLw();
@@ -132,9 +133,10 @@
// The drag window covers the entire display
mDragWindowHandle.frameLeft = 0;
mDragWindowHandle.frameTop = 0;
- DisplayInfo displayInfo = mDisplayContent.getDisplayInfo();
- mDragWindowHandle.frameRight = displayInfo.logicalWidth;
- mDragWindowHandle.frameBottom = displayInfo.logicalHeight;
+ Point p = new Point();
+ mDisplay.getRealSize(p);
+ mDragWindowHandle.frameRight = p.x;
+ mDragWindowHandle.frameBottom = p.y;
// Pause rotations before a drag.
if (WindowManagerService.DEBUG_ORIENTATION) {
@@ -187,7 +189,7 @@
Slog.d(WindowManagerService.TAG, "broadcasting DRAG_STARTED at (" + touchX + ", " + touchY + ")");
}
- final WindowList windows = mDisplayContent.getWindowList();
+ final WindowList windows = mService.getWindowList(mDisplay);
final int N = windows.size();
for (int i = 0; i < N; i++) {
sendDragStartedLw(windows.get(i), touchX, touchY, mDataDescription);
@@ -390,7 +392,7 @@
final int x = (int) xf;
final int y = (int) yf;
- final WindowList windows = mDisplayContent.getWindowList();
+ final WindowList windows = mService.getWindowList(mDisplay);
final int N = windows.size();
for (int i = N - 1; i >= 0; i--) {
WindowState child = windows.get(i);
diff --git a/services/java/com/android/server/wm/Session.java b/services/java/com/android/server/wm/Session.java
index 1ffbecc..4038b70 100644
--- a/services/java/com/android/server/wm/Session.java
+++ b/services/java/com/android/server/wm/Session.java
@@ -280,7 +280,7 @@
// !!! FIXME: put all this heavy stuff onto the mH looper, as well as
// the actual drag event dispatch stuff in the dragstate
- mService.mDragState.register(callingWin.mDisplayContent);
+ mService.mDragState.register(callingWin.mDisplayContent.getDisplay());
mService.mInputMonitor.updateInputWindowsLw(true /*force*/);
if (!mService.mInputManager.transferTouchFocus(callingWin.mInputChannel,
mService.mDragState.mServerChannel)) {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index acade04..b7eeb69 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -8301,7 +8301,7 @@
// This has changed the visibility of windows, so perform
// a new layout to get them all up-to-date.
- changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT
+ changes |= WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT
| WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
mLayoutNeeded = true;
@@ -8627,15 +8627,15 @@
mPendingLayoutChanges = 0;
if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("loop number " + mLayoutRepeatCount,
mPendingLayoutChanges);
- mPolicy.beginAnimationLw(dw, dh);
+ mPolicy.beginPostLayoutPolicyLw(dw, dh);
for (i = windows.size() - 1; i >= 0; i--) {
WindowState w = windows.get(i);
if (w.mHasSurface) {
- mPolicy.animatingWindowLw(w, w.mAttrs);
+ mPolicy.applyPostLayoutPolicyLw(w, w.mAttrs);
}
}
- mPendingLayoutChanges |= mPolicy.finishAnimationLw();
- if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after finishAnimationLw",
+ mPendingLayoutChanges |= mPolicy.finishPostLayoutPolicyLw();
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after finishPostLayoutPolicyLw",
mPendingLayoutChanges);
} while (mPendingLayoutChanges != 0);
@@ -9348,7 +9348,7 @@
}
}
- if ((focusChanged&WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
+ if ((focusChanged & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
// The change in focus caused us to need to do a layout. Okay.
mLayoutNeeded = true;
if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
@@ -10393,4 +10393,7 @@
return getDefaultDisplayContent().getDisplayInfo();
}
+ public WindowList getWindowList(final Display display) {
+ return getDisplayContent(display.getDisplayId()).getWindowList();
+ }
}