diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-03-18 01:04:37 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-03-18 01:12:42 -0700 |
commit | fdb553a221b0372998c7f53657edcd6804f6d632 (patch) | |
tree | 69f7ba2cae052da74ffec0e37a01bb616a04497f | |
parent | 9d08a7e59a5733cb159cb78ca3a93d9a0da5f009 (diff) | |
download | base-fdb553a221b0372998c7f53657edcd6804f6d632.tar.gz |
Policy part of fixing issue #2519590: Lock screen stuck in landscape mode
Change-Id: Id7f3a7102a86f4fecb7f7ef40b1275b75e27dac4
5 files changed, 86 insertions, 18 deletions
diff --git a/phone/com/android/internal/policy/impl/LockPatternKeyguardView.java b/phone/com/android/internal/policy/impl/LockPatternKeyguardView.java index 3deee6f..da51ad0 100644 --- a/phone/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/phone/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -60,6 +60,8 @@ import java.io.IOException; public class LockPatternKeyguardView extends KeyguardViewBase implements AccountManagerCallback<Account[]> { + static final boolean DEBUG_CONFIGURATION = false; + // time after launching EmergencyDialer before the screen goes blank. private static final int EMERGENCY_CALL_TIMEOUT = 10000; @@ -413,7 +415,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase ((KeyguardScreen) mLockScreen).onPause(); } ((KeyguardScreen) mLockScreen).cleanUp(); - removeViewInLayout(mLockScreen); + removeView(mLockScreen); mLockScreen = createLockScreen(); mLockScreen.setVisibility(View.INVISIBLE); @@ -425,7 +427,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase ((KeyguardScreen) mUnlockScreen).onPause(); } ((KeyguardScreen) mUnlockScreen).cleanUp(); - removeViewInLayout(mUnlockScreen); + removeView(mUnlockScreen); final UnlockMode unlockMode = getUnlockMode(); mUnlockScreen = createUnlockScreenFor(unlockMode); @@ -502,6 +504,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase private void updateScreen(final Mode mode) { + if (DEBUG_CONFIGURATION) Log.v(TAG, "**** UPDATE SCREEN: mode=" + mode + + " last mode=" + mMode, new RuntimeException()); + mMode = mode; // Re-create the unlock screen if necessary. This is primarily required to properly handle @@ -517,7 +522,11 @@ public class LockPatternKeyguardView extends KeyguardViewBase // flag is set mWindowController.setNeedsInput(((KeyguardScreen)visibleScreen).needsInput()); - + if (DEBUG_CONFIGURATION) { + Log.v(TAG, "Gone=" + goneScreen); + Log.v(TAG, "Visible=" + visibleScreen); + } + if (mScreenOn) { if (goneScreen.getVisibility() == View.VISIBLE) { ((KeyguardScreen) goneScreen).onPause(); @@ -529,7 +538,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase goneScreen.setVisibility(View.GONE); visibleScreen.setVisibility(View.VISIBLE); - + requestLayout(); if (!visibleScreen.requestFocus()) { throw new IllegalStateException("keyguard screen must be able to take " diff --git a/phone/com/android/internal/policy/impl/LockScreen.java b/phone/com/android/internal/policy/impl/LockScreen.java index ae1367a..baed9eb 100644 --- a/phone/com/android/internal/policy/impl/LockScreen.java +++ b/phone/com/android/internal/policy/impl/LockScreen.java @@ -180,6 +180,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM mKeyboardHidden = configuration.hardKeyboardHidden; + if (LockPatternKeyguardView.DEBUG_CONFIGURATION) { + Log.v(TAG, "***** CREATING LOCK SCREEN", new RuntimeException()); + Log.v(TAG, "Cur orient=" + mCreationOrientation + + " res orient=" + context.getResources().getConfiguration().orientation); + } + final LayoutInflater inflater = LayoutInflater.from(context); if (DBG) Log.v(TAG, "Creation orientation = " + mCreationOrientation); if (mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE) { @@ -600,16 +606,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM updateStatusLines(); } - /** {@inheritDoc} */ - @Override - protected void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - if (DBG) { - Log.v(TAG, "onConfigurationChanged() time " + SystemClock.elapsedRealtime()); - if (getResources().getConfiguration().orientation != newConfig.orientation) { - Log.e(TAG, "mismatchConfig: ", new Exception("stack trace:")); - } - } + void updateConfiguration() { + Configuration newConfig = getResources().getConfiguration(); if (newConfig.orientation != mCreationOrientation) { mCallback.recreateMe(newConfig); } else if (newConfig.hardKeyboardHidden != mKeyboardHidden) { @@ -620,6 +618,29 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM } } } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + if (LockPatternKeyguardView.DEBUG_CONFIGURATION) { + Log.v(TAG, "***** LOCK ATTACHED TO WINDOW"); + Log.v(TAG, "Cur orient=" + mCreationOrientation + + ", new config=" + getResources().getConfiguration()); + } + updateConfiguration(); + } + + /** {@inheritDoc} */ + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + if (LockPatternKeyguardView.DEBUG_CONFIGURATION) { + Log.w(TAG, "***** LOCK CONFIG CHANGING", new RuntimeException()); + Log.v(TAG, "Cur orient=" + mCreationOrientation + + ", new config=" + newConfig); + } + updateConfiguration(); + } /** {@inheritDoc} */ public boolean needsInput() { diff --git a/phone/com/android/internal/policy/impl/PasswordUnlockScreen.java b/phone/com/android/internal/policy/impl/PasswordUnlockScreen.java index e08fe4f..07eaf93 100644 --- a/phone/com/android/internal/policy/impl/PasswordUnlockScreen.java +++ b/phone/com/android/internal/policy/impl/PasswordUnlockScreen.java @@ -206,6 +206,14 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen return false; } + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + if (getResources().getConfiguration().orientation != mCreationOrientation) { + mCallback.recreateMe(getResources().getConfiguration()); + } + } + /** {@inheritDoc} */ @Override protected void onConfigurationChanged(Configuration newConfig) { diff --git a/phone/com/android/internal/policy/impl/PatternUnlockScreen.java b/phone/com/android/internal/policy/impl/PatternUnlockScreen.java index a93b462..418e243 100644 --- a/phone/com/android/internal/policy/impl/PatternUnlockScreen.java +++ b/phone/com/android/internal/policy/impl/PatternUnlockScreen.java @@ -398,11 +398,29 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient public void onSimStateChanged(IccCard.State simState) { } + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + if (LockPatternKeyguardView.DEBUG_CONFIGURATION) { + Log.v(TAG, "***** PATTERN ATTACHED TO WINDOW"); + Log.v(TAG, "Cur orient=" + mCreationOrientation + + ", new config=" + getResources().getConfiguration()); + } + if (getResources().getConfiguration().orientation != mCreationOrientation) { + mCallback.recreateMe(getResources().getConfiguration()); + } + } + /** {@inheritDoc} */ @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); + if (LockPatternKeyguardView.DEBUG_CONFIGURATION) { + Log.v(TAG, "***** PATTERN CONFIGURATION CHANGED"); + Log.v(TAG, "Cur orient=" + mCreationOrientation + + ", new config=" + getResources().getConfiguration()); + } if (newConfig.orientation != mCreationOrientation) { mCallback.recreateMe(newConfig); } diff --git a/phone/com/android/internal/policy/impl/SimUnlockScreen.java b/phone/com/android/internal/policy/impl/SimUnlockScreen.java index d92b961..5518e11 100644 --- a/phone/com/android/internal/policy/impl/SimUnlockScreen.java +++ b/phone/com/android/internal/policy/impl/SimUnlockScreen.java @@ -279,10 +279,8 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie mEnteredPin[mEnteredDigits++] = digit; } - /** {@inheritDoc} */ - @Override - protected void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); + void updateConfiguration() { + Configuration newConfig = getResources().getConfiguration(); if (newConfig.orientation != mCreationOrientation) { mCallback.recreateMe(newConfig); } else if (newConfig.hardKeyboardHidden != mKeyboardHidden) { @@ -292,6 +290,20 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie mCallback.goToUnlockScreen(); } } + + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + updateConfiguration(); + } + + /** {@inheritDoc} */ + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + updateConfiguration(); } /** |