diff options
author | Jim Miller <jaggies@google.com> | 2010-03-11 15:46:29 -0800 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2010-03-12 17:35:59 -0800 |
commit | ba945c0183e84018a8c2a678fa3d50876e1a5ee4 (patch) | |
tree | a7627b17169492854a1c0b9bafe60b32ed67d754 /phone/com/android/internal/policy/impl/SimUnlockScreen.java | |
parent | 67accfd37face47d46d770aa3b7b6458b1e44a74 (diff) | |
download | base-ba945c0183e84018a8c2a678fa3d50876e1a5ee4.tar.gz |
Fix 2428368: Fix most of the lockscreen orientation refresh bugs
This change removes the legacy notification of orientation and configuration changed events
from KeyguardUpdateMonitor and moves them into the individual activities. This was necessary
to guarantee order of events.
In addition, to minimize discrepencies due to notification lag, Keyguard screens (LockScreen,
PatternUnlock, etc.) are now responsible for handling onConfigurationChanged() notification and
forwarding them to LockPatternKeyguardView by a call to recreateMe() with the new configuration.
This also removes the hack that used to prevent drawing while the configuration was in flux.
Change-Id: I6b72e8c06cebb2c5c83e2debeb478e89b6f6f386
Diffstat (limited to 'phone/com/android/internal/policy/impl/SimUnlockScreen.java')
-rw-r--r-- | phone/com/android/internal/policy/impl/SimUnlockScreen.java | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/phone/com/android/internal/policy/impl/SimUnlockScreen.java b/phone/com/android/internal/policy/impl/SimUnlockScreen.java index d5da274..d92b961 100644 --- a/phone/com/android/internal/policy/impl/SimUnlockScreen.java +++ b/phone/com/android/internal/policy/impl/SimUnlockScreen.java @@ -19,8 +19,10 @@ package com.android.internal.policy.impl; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; +import android.content.res.Configuration; import android.os.RemoteException; import android.os.ServiceManager; + import com.android.internal.telephony.ITelephony; import com.android.internal.widget.LockPatternUtils; @@ -38,15 +40,13 @@ import com.android.internal.R; * Displays a dialer like interface to unlock the SIM PIN. */ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, View.OnClickListener, - KeyguardUpdateMonitor.ConfigurationChangeCallback, KeyguardUpdateMonitor.InfoCallback { + KeyguardUpdateMonitor.InfoCallback { private static final int DIGIT_PRESS_WAKE_MILLIS = 5000; private final KeyguardUpdateMonitor mUpdateMonitor; private final KeyguardScreenCallback mCallback; - private final boolean mCreatedWithKeyboardOpen; - private TextView mHeaderText; private TextView mPinText; @@ -62,20 +62,28 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie private LockPatternUtils mLockPatternUtils; + private int mCreationOrientation; + + private int mKeyboardHidden; + private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; - public SimUnlockScreen(Context context, KeyguardUpdateMonitor updateMonitor, - KeyguardScreenCallback callback, LockPatternUtils lockpatternutils) { + public SimUnlockScreen(Context context, Configuration configuration, + KeyguardUpdateMonitor updateMonitor, KeyguardScreenCallback callback, + LockPatternUtils lockpatternutils) { super(context); mUpdateMonitor = updateMonitor; mCallback = callback; - mCreatedWithKeyboardOpen = mUpdateMonitor.isKeyboardOpen(); + + mCreationOrientation = configuration.orientation; + mKeyboardHidden = configuration.hardKeyboardHidden; mLockPatternUtils = lockpatternutils; - if (mCreatedWithKeyboardOpen) { - LayoutInflater.from(context).inflate(R.layout.keyguard_screen_sim_pin_landscape, this, true); + LayoutInflater inflater = LayoutInflater.from(context); + if (mKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) { + inflater.inflate(R.layout.keyguard_screen_sim_pin_landscape, this, true); } else { - LayoutInflater.from(context).inflate(R.layout.keyguard_screen_sim_pin_portrait, this, true); + inflater.inflate(R.layout.keyguard_screen_sim_pin_portrait, this, true); new TouchInput(); } @@ -94,7 +102,6 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie mEmergencyCallButton.setOnClickListener(this); mOkButton.setOnClickListener(this); - mUpdateMonitor.registerConfigurationChangeCallback(this); setFocusableInTouchMode(true); } @@ -272,11 +279,18 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie mEnteredPin[mEnteredDigits++] = digit; } - public void onOrientationChange(boolean inPortrait) {} - - public void onKeyboardChange(boolean isKeyboardOpen) { - if (isKeyboardOpen != mCreatedWithKeyboardOpen) { - mCallback.recreateMe(); + /** {@inheritDoc} */ + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + if (newConfig.orientation != mCreationOrientation) { + mCallback.recreateMe(newConfig); + } else if (newConfig.hardKeyboardHidden != mKeyboardHidden) { + mKeyboardHidden = newConfig.hardKeyboardHidden; + final boolean isKeyboardOpen = mKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO; + if (mUpdateMonitor.isKeyguardBypassEnabled() && isKeyboardOpen) { + mCallback.goToUnlockScreen(); + } } } |