summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2014-02-13 19:02:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-13 19:02:02 +0000
commit0af894d25133890e7765e6c582b3ac4829070de8 (patch)
tree130e48a3cbac6fdb91e5e8488b876ff318a62926
parent820bb4bdd358bfaac446b8ce4af5474dcfc77613 (diff)
parentb660b9d8cf6b951b85a35599d636c470795e9a1a (diff)
downloadframeworks_base-0af894d25133890e7765e6c582b3ac4829070de8.zip
frameworks_base-0af894d25133890e7765e6c582b3ac4829070de8.tar.gz
frameworks_base-0af894d25133890e7765e6c582b3ac4829070de8.tar.bz2
Merge "Update DimLayer sizes on rotation." into klp-modular-dev
-rw-r--r--services/core/java/com/android/server/wm/DimLayer.java5
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java18
-rw-r--r--services/core/java/com/android/server/wm/TaskStack.java56
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java2
4 files changed, 38 insertions, 43 deletions
diff --git a/services/core/java/com/android/server/wm/DimLayer.java b/services/core/java/com/android/server/wm/DimLayer.java
index 574ae2d..aa7d485 100644
--- a/services/core/java/com/android/server/wm/DimLayer.java
+++ b/services/core/java/com/android/server/wm/DimLayer.java
@@ -127,6 +127,11 @@ public class DimLayer {
void setBounds(Rect bounds) {
mBounds.set(bounds);
+ if (isDimming() && !mLastBounds.equals(bounds)) {
+ // Clearing mAlpha forces show to redisplay with new size.
+ mAlpha = 0;
+ show();
+ }
}
/**
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 415a06b..68834d8 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -170,22 +170,13 @@ class DisplayContent {
}
void updateDisplayInfo() {
- // Save old size.
- int oldWidth = mDisplayInfo.logicalWidth;
- int oldHeight = mDisplayInfo.logicalHeight;
mDisplay.getDisplayInfo(mDisplayInfo);
-
for (int i = mStacks.size() - 1; i >= 0; --i) {
- final TaskStack stack = mStacks.get(i);
- if (!stack.isFullscreen()) {
- stack.resizeBounds(oldWidth, oldHeight, mDisplayInfo.logicalWidth,
- mDisplayInfo.logicalHeight);
- }
+ mStacks.get(i).updateDisplayInfo();
}
}
void getLogicalDisplayRect(Rect out) {
- updateDisplayInfo();
// Uses same calculation as in LogicalDisplay#configureDisplayInTransactionLocked.
final int orientation = mDisplayInfo.rotation;
boolean rotated = (orientation == Surface.ROTATION_90
@@ -291,11 +282,12 @@ class DisplayContent {
}
boolean isDimming() {
- boolean result = false;
for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
- result |= mStacks.get(stackNdx).isDimming();
+ if (mStacks.get(stackNdx).isDimming()) {
+ return true;
+ }
}
- return result;
+ return false;
}
void stopDimmingIfNeeded() {
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 7d8cff4..a605900 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -47,12 +47,17 @@ public class TaskStack {
* mTaskHistory in the ActivityStack with the same mStackId */
private final ArrayList<Task> mTasks = new ArrayList<Task>();
- /** Content limits relative to the DisplayContent this sits in. Empty indicates fullscreen,
- * Nonempty is size of this TaskStack but is also used to scale if DisplayContent changes. */
- Rect mBounds = new Rect();
+ /** For comparison with DisplayContent bounds. */
+ private Rect mTmpRect = new Rect();
+
+ /** Content limits relative to the DisplayContent this sits in. */
+ private Rect mBounds = new Rect();
+
+ /** Whether mBounds is fullscreen */
+ private boolean mFullscreen = true;
/** Used to support {@link android.view.WindowManager.LayoutParams#FLAG_DIM_BEHIND} */
- DimLayer mDimLayer;
+ private DimLayer mDimLayer;
/** The particular window with FLAG_DIM_BEHIND set. If null, hide mDimLayer. */
WindowStateAnimator mDimWinAnimator;
@@ -86,7 +91,7 @@ public class TaskStack {
return mTasks;
}
- private void resizeWindows() {
+ void resizeWindows() {
final boolean underStatusBar = mBounds.top == 0;
final ArrayList<WindowState> resizingWindows = mService.mResizingWindows;
@@ -108,7 +113,13 @@ public class TaskStack {
}
boolean setBounds(Rect bounds) {
- if (mBounds.equals(bounds)) {
+ boolean oldFullscreen = mFullscreen;
+ if (mDisplayContent != null) {
+ mDisplayContent.getLogicalDisplayRect(mTmpRect);
+ mFullscreen = mTmpRect.equals(bounds);
+ }
+
+ if (mBounds.equals(bounds) && oldFullscreen == mFullscreen) {
return false;
}
@@ -116,25 +127,22 @@ public class TaskStack {
mAnimationBackgroundSurface.setBounds(bounds);
mBounds.set(bounds);
- resizeWindows();
return true;
}
void getBounds(Rect out) {
- if (mDisplayContent != null) {
- if (mBounds.isEmpty()) {
- mDisplayContent.getLogicalDisplayRect(out);
- } else {
- out.set(mBounds);
- }
- out.intersect(mDisplayContent.mContentRect);
- } else {
- out.set(mBounds);
+ out.set(mBounds);
+ }
+
+ void updateDisplayInfo() {
+ if (mFullscreen && mDisplayContent != null) {
+ mDisplayContent.getLogicalDisplayRect(mTmpRect);
+ setBounds(mTmpRect);
}
}
boolean isFullscreen() {
- return mBounds.isEmpty();
+ return mFullscreen;
}
boolean isAnimating() {
@@ -152,19 +160,6 @@ public class TaskStack {
return false;
}
- void resizeBounds(float oldWidth, float oldHeight, float newWidth, float newHeight) {
- if (oldWidth == newWidth && oldHeight == newHeight) {
- return;
- }
- float widthScale = newWidth / oldWidth;
- float heightScale = newHeight / oldHeight;
- mBounds.left = (int)(mBounds.left * widthScale + 0.5);
- mBounds.top = (int)(mBounds.top * heightScale + 0.5);
- mBounds.right = (int)(mBounds.right * widthScale + 0.5);
- mBounds.bottom = (int)(mBounds.bottom * heightScale + 0.5);
- resizeWindows();
- }
-
/**
* Put a Task in this stack. Used for adding and moving.
* @param task The task to add.
@@ -233,6 +228,7 @@ public class TaskStack {
mDisplayContent = displayContent;
mDimLayer = new DimLayer(mService, this, displayContent);
mAnimationBackgroundSurface = new DimLayer(mService, this, displayContent);
+ updateDisplayInfo();
}
void detachDisplay() {
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index f6a8a03..296e50b 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -4990,6 +4990,7 @@ public class WindowManagerService extends IWindowManager.Stub
+ " not found.");
}
if (stack.setBounds(bounds)) {
+ stack.resizeWindows();
stack.getDisplayContent().layoutNeeded = true;
performLayoutAndPlaceSurfacesLocked();
}
@@ -9961,6 +9962,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
// TODO(multidisplay): rotation on main screen only.
+ displayContent.updateDisplayInfo();
screenRotationAnimation = new ScreenRotationAnimation(mContext, displayContent,
mFxSession, inTransaction, mPolicy.isDefaultOrientationForced());
mAnimator.setScreenRotationAnimationLocked(displayId, screenRotationAnimation);