diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-06-07 14:09:47 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-06-08 18:45:43 -0700 |
commit | 5fd2169eabd77e6bfafaf456e58051a3bafb2bca (patch) | |
tree | 77048c3540c64cad77e5c140b6477a321190c586 /services/java/com/android/server/wm/WindowManagerService.java | |
parent | 4381f6421ca408d1dc66430ddfb107c5011bfe25 (diff) | |
download | frameworks_base-5fd2169eabd77e6bfafaf456e58051a3bafb2bca.zip frameworks_base-5fd2169eabd77e6bfafaf456e58051a3bafb2bca.tar.gz frameworks_base-5fd2169eabd77e6bfafaf456e58051a3bafb2bca.tar.bz2 |
Work on issue #4518815: Compatibility mode introduces compatibility regression...
...for Market App iRunner
There were a lot of serious issues with how we updated (or often didn't update)
the display and resource state when switching compatibility mode in conjunction
with restarting and updating application components. This addresses everything
I could find.
Unfortunately it does *not* fix this particular app. I am starting to think this
is just an issue in the app. This change does fix a number of other problems
I could repro, such as switching the compatibility mode of an IME.
Also a few changes here and there to get rid of $#*&^!! debug logs.
Change-Id: Ib15572eac9ec93b4b9966ddcbbc830ce9dec1317
Diffstat (limited to 'services/java/com/android/server/wm/WindowManagerService.java')
-rw-r--r-- | services/java/com/android/server/wm/WindowManagerService.java | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 9291182..7b09cc6 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -19,6 +19,7 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.FLAG_BLUR_BEHIND; +import static android.view.WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW; import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; @@ -160,6 +161,7 @@ public class WindowManagerService extends IWindowManager.Stub static final boolean DEBUG_REORDER = false; static final boolean DEBUG_WALLPAPER = false; static final boolean DEBUG_DRAG = false; + static final boolean SHOW_SURFACE_ALLOC = false; static final boolean SHOW_TRANSACTIONS = false; static final boolean HIDE_STACK_CRAWLS = true; @@ -463,6 +465,9 @@ public class WindowManagerService extends IWindowManager.Stub Display mDisplay; + final DisplayMetrics mDisplayMetrics = new DisplayMetrics(); + final DisplayMetrics mCompatDisplayMetrics = new DisplayMetrics(); + H mH = new H(); WindowState mCurrentFocus = null; @@ -2489,6 +2494,8 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": " + win.mAttrs); + win.mEnforceSizeCompat = (win.mAttrs.flags & FLAG_COMPATIBLE_WINDOW) != 0; + if ((attrChanges & WindowManager.LayoutParams.ALPHA_CHANGED) != 0) { win.mAlpha = attrs.alpha; } @@ -5052,7 +5059,7 @@ public class WindowManagerService extends IWindowManager.Stub mWaitingForConfig = true; mLayoutNeeded = true; startFreezingDisplayLocked(inTransaction); - Slog.i(TAG, "Setting rotation to " + rotation + ", animFlags=" + animFlags); + //Slog.i(TAG, "Setting rotation to " + rotation + ", animFlags=" + animFlags); mInputManager.setDisplayOrientation(0, rotation); if (mDisplayEnabled) { // NOTE: We disable the rotation in the emulator because @@ -5522,6 +5529,26 @@ public class WindowManagerService extends IWindowManager.Stub return curSize; } + private int computeSmallestWidth(boolean rotated, int dw, int dh, float density) { + // We need to determine the smallest width that will occur under normal + // operation. To this, start with the base screen size and compute the + // width under the different possible rotations. We need to un-rotate + // the current screen dimensions before doing this. + int unrotDw, unrotDh; + if (rotated) { + unrotDw = dh; + unrotDh = dw; + } else { + unrotDw = dw; + unrotDh = dh; + } + int sw = reduceConfigWidthSize(unrotDw, Surface.ROTATION_0, density, unrotDw); + sw = reduceConfigWidthSize(sw, Surface.ROTATION_90, density, unrotDh); + sw = reduceConfigWidthSize(sw, Surface.ROTATION_180, density, unrotDw); + sw = reduceConfigWidthSize(sw, Surface.ROTATION_270, density, unrotDh); + return sw; + } + boolean computeNewConfigurationLocked(Configuration config) { if (mDisplay == null) { return false; @@ -5567,7 +5594,7 @@ public class WindowManagerService extends IWindowManager.Stub } config.orientation = orientation; - DisplayMetrics dm = new DisplayMetrics(); + DisplayMetrics dm = mDisplayMetrics; mDisplay.getRealMetrics(dm); // Override display width and height with what we are computing, @@ -5577,10 +5604,17 @@ public class WindowManagerService extends IWindowManager.Stub dm.heightPixels = dm.unscaledHeightPixels = mAppDisplayHeight = mPolicy.getNonDecorDisplayHeight(mRotation, dh); - mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm, null); + mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm, + mCompatDisplayMetrics); config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(mRotation, dw) / dm.density); config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(mRotation, dh) / dm.density); + config.smallestScreenWidthDp = computeSmallestWidth(rotated, dw, dh, dm.density); + + config.compatScreenWidthDp = (int)(config.screenWidthDp / mCompatibleScreenScale); + config.compatScreenHeightDp = (int)(config.screenHeightDp / mCompatibleScreenScale); + config.compatSmallestScreenWidthDp = (int)(config.smallestScreenWidthDp + / mCompatibleScreenScale); // We need to determine the smallest width that will occur under normal // operation. To this, start with the base screen size and compute the @@ -8446,7 +8480,8 @@ public class WindowManagerService extends IWindowManager.Stub // surface and ask the app to request another one. Slog.w(TAG, "Looks like we have reclaimed some memory, clearing surface for retry."); if (surface != null) { - if (SHOW_TRANSACTIONS) logSurface(win, "RECOVER DESTROY", null); + if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) logSurface(win, + "RECOVER DESTROY", null); surface.destroy(); win.mSurfaceShown = false; win.mSurface = null; |