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 /core/java/android/view/ViewRoot.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 'core/java/android/view/ViewRoot.java')
-rw-r--r-- | core/java/android/view/ViewRoot.java | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index 2098955..cdb0339 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -159,6 +159,8 @@ public final class ViewRoot extends Handler implements ViewParent, // so the window should no longer be active. boolean mStopped = false; + boolean mLastInCompatMode = false; + SurfaceHolder.Callback2 mSurfaceHolderCallback; BaseSurfaceHolder mSurfaceHolder; boolean mIsCreating; @@ -204,6 +206,8 @@ public final class ViewRoot extends Handler implements ViewParent, boolean mAdded; boolean mAddedTouchMode; + CompatibilityInfoHolder mCompatibilityInfo; + /*package*/ int mAddNesting; // These are accessed by multiple threads. @@ -369,8 +373,7 @@ public final class ViewRoot extends Handler implements ViewParent, enableHardwareAcceleration(attrs); } - Resources resources = mView.getContext().getResources(); - CompatibilityInfo compatibilityInfo = resources.getCompatibilityInfo(); + CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get(); mTranslator = compatibilityInfo.getTranslator(); if (mTranslator != null) { @@ -387,6 +390,7 @@ public final class ViewRoot extends Handler implements ViewParent, if (!compatibilityInfo.supportsScreen()) { attrs.flags |= WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW; + mLastInCompatMode = true; } mSoftInputMode = attrs.softInputMode; @@ -719,6 +723,19 @@ public final class ViewRoot extends Handler implements ViewParent, surfaceChanged = true; params = lp; } + CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get(); + if (compatibilityInfo.supportsScreen() == mLastInCompatMode) { + params = lp; + fullRedrawNeeded = true; + mLayoutRequested = true; + if (mLastInCompatMode) { + params.flags &= ~WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW; + mLastInCompatMode = false; + } else { + params.flags |= WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW; + mLastInCompatMode = true; + } + } Rect frame = mWinFrame; if (mFirst) { fullRedrawNeeded = true; @@ -1934,6 +1951,13 @@ public final class ViewRoot extends Handler implements ViewParent, "Applying new config to window " + mWindowAttributes.getTitle() + ": " + config); + + CompatibilityInfo ci = mCompatibilityInfo.getIfNeeded(); + if (ci != null) { + config = new Configuration(config); + ci.applyToConfiguration(config); + } + synchronized (sConfigCallbacks) { for (int i=sConfigCallbacks.size()-1; i>=0; i--) { sConfigCallbacks.get(i).onConfigurationChanged(config); @@ -1995,6 +2019,7 @@ public final class ViewRoot extends Handler implements ViewParent, public final static int DISPATCH_DRAG_LOCATION_EVENT = 1016; public final static int DISPATCH_SYSTEM_UI_VISIBILITY = 1017; public final static int DISPATCH_GENERIC_MOTION = 1018; + public final static int UPDATE_CONFIGURATION = 1019; @Override public void handleMessage(Message msg) { @@ -2178,6 +2203,13 @@ public final class ViewRoot extends Handler implements ViewParent, case DISPATCH_SYSTEM_UI_VISIBILITY: { handleDispatchSystemUiVisibilityChanged(msg.arg1); } break; + case UPDATE_CONFIGURATION: { + Configuration config = (Configuration)msg.obj; + if (config.isOtherSeqNewer(mLastConfiguration)) { + config = mLastConfiguration; + } + updateConfiguration(config, false); + } break; } } @@ -3205,6 +3237,11 @@ public final class ViewRoot extends Handler implements ViewParent, } } + public void requestUpdateConfiguration(Configuration config) { + Message msg = obtainMessage(UPDATE_CONFIGURATION, config); + sendMessage(msg); + } + private void destroyHardwareRenderer() { if (mAttachInfo.mHardwareRenderer != null) { mAttachInfo.mHardwareRenderer.destroy(true); |