diff options
author | Jim Miller <jaggies@google.com> | 2010-01-21 18:27:47 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-01-21 18:27:47 -0800 |
commit | 79ebdf2142ec90b311466ec22d89a38c2971bbf0 (patch) | |
tree | 60dfe613ccaa8f8a9aa36a949e4cc5517a7bcd17 /policy/com | |
parent | 9f686a4eb3fd460148ae9b46e73b02f89ee33e53 (diff) | |
parent | dc893738d8059b3ad5ad9b4f84d65730cbcef14e (diff) | |
download | frameworks_base-79ebdf2142ec90b311466ec22d89a38c2971bbf0.zip frameworks_base-79ebdf2142ec90b311466ec22d89a38c2971bbf0.tar.gz frameworks_base-79ebdf2142ec90b311466ec22d89a38c2971bbf0.tar.bz2 |
am a3b4a811: Merge "Fix for 2292713: Remove workaround that hides SlidingTab widget while internal state is inconsistent." into eclair
Merge commit 'a3b4a8111c47852e212032008732e143636151e4' into eclair-plus-aosp
* commit 'a3b4a8111c47852e212032008732e143636151e4':
Fix for 2292713: Remove workaround that hides SlidingTab widget while internal state is inconsistent.
Diffstat (limited to 'policy/com')
-rw-r--r-- | policy/com/android/internal/policy/impl/LockPatternKeyguardView.java | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java index 00dc929..85918fb 100644 --- a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -29,6 +29,7 @@ import android.accounts.OperationCanceledException; import android.app.AlertDialog; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.ColorFilter; @@ -40,6 +41,7 @@ import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import android.view.View; +import android.view.ViewGroup; import android.view.WindowManager; import java.io.IOException; @@ -139,6 +141,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase */ private final LockPatternUtils mLockPatternUtils; + private boolean mIsPortrait; + /** * @return Whether we are stuck on the lock screen because the sim is * missing. @@ -266,7 +270,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase public void reportFailedPatternAttempt() { mUpdateMonitor.reportFailedAttempt(); final int failedAttempts = mUpdateMonitor.getFailedAttempts(); - if (DEBUG) Log.d(TAG, + if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts + " (enableFallback=" + mEnableFallback + ")"); if (mEnableFallback && failedAttempts == @@ -307,7 +311,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase mLockScreen = createLockScreen(); addView(mLockScreen); final UnlockMode unlockMode = getUnlockMode(); - if (DEBUG) Log.d(TAG, + if (DEBUG) Log.d(TAG, "LockPatternKeyguardView ctor: about to createUnlockScreenFor; mEnableFallback=" + mEnableFallback); mUnlockScreen = createUnlockScreenFor(unlockMode); @@ -334,6 +338,33 @@ public class LockPatternKeyguardView extends KeyguardViewBase } + // TODO: + // This overloaded method was added to workaround a race condition in the framework between + // notification for orientation changed, layout() and switching resources. This code attempts + // to avoid drawing the incorrect layout while things are in transition. The method can just + // be removed once the race condition is fixed. See bugs 2262578 and 2292713. + @Override + protected void dispatchDraw(Canvas canvas) { + final int orientation = getResources().getConfiguration().orientation; + if (mIsPortrait && Configuration.ORIENTATION_PORTRAIT != orientation + || getResources().getBoolean(R.bool.lockscreen_isPortrait) != mIsPortrait) { + // Make sure we redraw once things settle down. + // Log.v(TAG, "dispatchDraw(): not drawing because state is inconsistent"); + postInvalidate(); + + // In order to minimize flashing, draw the first child's background for now. + ViewGroup view = (ViewGroup) (mMode == Mode.LockScreen ? mLockScreen : mUnlockScreen); + if (view != null && view.getChildAt(0) != null) { + Drawable background = view.getChildAt(0).getBackground(); + if (background != null) { + background.draw(canvas); + } + } + return; + } + super.dispatchDraw(canvas); + } + @Override public void reset() { mIsVerifyUnlockOnly = false; @@ -482,6 +513,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase } View createUnlockScreenFor(UnlockMode unlockMode) { + // Capture the orientation this layout was created in. + mIsPortrait = getResources().getBoolean(R.bool.lockscreen_isPortrait); + if (unlockMode == UnlockMode.Pattern) { UnlockScreen view = new UnlockScreen( mContext, |