diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-06-09 18:42:55 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-06-09 18:42:55 -0700 |
commit | 7bbf6f7d11877496502c20e8998a6984ab05cd39 (patch) | |
tree | 05bb937ccdb4304842f7953a81c064331e522ace /services | |
parent | e6b03d0979e0bd6dfeda7b45850182c3092bb3e7 (diff) | |
parent | 8297f669356ee997c5faa745815e8b9a7009fba7 (diff) | |
download | frameworks_base-7bbf6f7d11877496502c20e8998a6984ab05cd39.zip frameworks_base-7bbf6f7d11877496502c20e8998a6984ab05cd39.tar.gz frameworks_base-7bbf6f7d11877496502c20e8998a6984ab05cd39.tar.bz2 |
am 8297f669: am 3aabdeac: am 5ba2e872: Merge "Fix for not reporting correct "sw" in compat mode." into honeycomb-mr2
* commit '8297f669356ee997c5faa745815e8b9a7009fba7':
Fix for not reporting correct "sw" in compat mode.
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/wm/WindowManagerService.java | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index fc640f3..86c899e 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -466,6 +466,7 @@ public class WindowManagerService extends IWindowManager.Stub Display mDisplay; final DisplayMetrics mDisplayMetrics = new DisplayMetrics(); + final DisplayMetrics mTmpDisplayMetrics = new DisplayMetrics(); final DisplayMetrics mCompatDisplayMetrics = new DisplayMetrics(); H mH = new H(); @@ -5553,6 +5554,36 @@ public class WindowManagerService extends IWindowManager.Stub return sw; } + private int reduceCompatConfigWidthSize(int curSize, int rotation, DisplayMetrics dm, + int dw, int dh) { + dm.unscaledWidthPixels = mPolicy.getNonDecorDisplayWidth(rotation, dw); + dm.unscaledHeightPixels = mPolicy.getNonDecorDisplayHeight(rotation, dh); + float scale = CompatibilityInfo.computeCompatibleScaling(dm, null); + int size = (int)(((dm.unscaledWidthPixels / scale) / dm.density) + .5f); + if (curSize == 0 || size < curSize) { + curSize = size; + } + return curSize; + } + + private int computeCompatSmallestWidth(boolean rotated, DisplayMetrics dm, int dw, int dh) { + mTmpDisplayMetrics.setTo(dm); + dm = mTmpDisplayMetrics; + int unrotDw, unrotDh; + if (rotated) { + unrotDw = dh; + unrotDh = dw; + } else { + unrotDw = dw; + unrotDh = dh; + } + int sw = reduceCompatConfigWidthSize(0, Surface.ROTATION_0, dm, unrotDw, unrotDh); + sw = reduceCompatConfigWidthSize(sw, Surface.ROTATION_90, dm, unrotDh, unrotDw); + sw = reduceCompatConfigWidthSize(sw, Surface.ROTATION_180, dm, unrotDw, unrotDh); + sw = reduceCompatConfigWidthSize(sw, Surface.ROTATION_270, dm, unrotDh, unrotDw); + return sw; + } + boolean computeNewConfigurationLocked(Configuration config) { if (mDisplay == null) { return false; @@ -5617,8 +5648,7 @@ public class WindowManagerService extends IWindowManager.Stub config.compatScreenWidthDp = (int)(config.screenWidthDp / mCompatibleScreenScale); config.compatScreenHeightDp = (int)(config.screenHeightDp / mCompatibleScreenScale); - config.compatSmallestScreenWidthDp = (int)(config.smallestScreenWidthDp - / mCompatibleScreenScale); + config.compatSmallestScreenWidthDp = computeCompatSmallestWidth(rotated, dm, dw, dh); // We need to determine the smallest width that will occur under normal // operation. To this, start with the base screen size and compute the @@ -8095,7 +8125,7 @@ public class WindowManagerService extends IWindowManager.Stub if (mDimAnimator == null) { mDimAnimator = new DimAnimator(mFxSession); } - mDimAnimator.show(dw, dh); + mDimAnimator.show(innerDw, innerDh); mDimAnimator.updateParameters(mContext.getResources(), w, currentTime); } |