diff options
author | Jim Miller <jaggies@google.com> | 2011-11-17 17:41:50 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-17 17:41:50 -0800 |
commit | 398f80eacb8e59d868f287bf273a1253fe219ce4 (patch) | |
tree | 21b35ab05260c94fa4cc4fbb978420674f76513a /policy | |
parent | 2ba13186b268de3527af6da1933a4b65877548d9 (diff) | |
parent | 90d5d46b9e1bfc2df1a4a16b411eafb43c80eba5 (diff) | |
download | frameworks_base-398f80eacb8e59d868f287bf273a1253fe219ce4.zip frameworks_base-398f80eacb8e59d868f287bf273a1253fe219ce4.tar.gz frameworks_base-398f80eacb8e59d868f287bf273a1253fe219ce4.tar.bz2 |
Merge "Fix 5620754: don't show pattern screen after SIM PUK unlock" into ics-mr1
Diffstat (limited to 'policy')
3 files changed, 58 insertions, 42 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java index 84540a1..b4b82aa 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java @@ -110,10 +110,14 @@ public class KeyguardUpdateMonitor { * the intent and provide a {@link SimCard.State} result. */ private static class SimArgs { - public final IccCard.State simState; - private SimArgs(Intent intent) { + SimArgs(IccCard.State state) { + simState = state; + } + + static SimArgs fromIntent(Intent intent) { + IccCard.State state; if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) { throw new IllegalArgumentException("only handles intent ACTION_SIM_STATE_CHANGED"); } @@ -124,27 +128,28 @@ public class KeyguardUpdateMonitor { if (IccCard.INTENT_VALUE_ABSENT_ON_PERM_DISABLED.equals( absentReason)) { - this.simState = IccCard.State.PERM_DISABLED; + state = IccCard.State.PERM_DISABLED; } else { - this.simState = IccCard.State.ABSENT; + state = IccCard.State.ABSENT; } } else if (IccCard.INTENT_VALUE_ICC_READY.equals(stateExtra)) { - this.simState = IccCard.State.READY; + state = IccCard.State.READY; } else if (IccCard.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) { final String lockedReason = intent .getStringExtra(IccCard.INTENT_KEY_LOCKED_REASON); if (IccCard.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) { - this.simState = IccCard.State.PIN_REQUIRED; + state = IccCard.State.PIN_REQUIRED; } else if (IccCard.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) { - this.simState = IccCard.State.PUK_REQUIRED; + state = IccCard.State.PUK_REQUIRED; } else { - this.simState = IccCard.State.UNKNOWN; + state = IccCard.State.UNKNOWN; } } else if (IccCard.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) { - this.simState = IccCard.State.NETWORK_LOCKED; + state = IccCard.State.NETWORK_LOCKED; } else { - this.simState = IccCard.State.UNKNOWN; + state = IccCard.State.UNKNOWN; } + return new SimArgs(state); } public String toString() { @@ -279,8 +284,7 @@ public class KeyguardUpdateMonitor { mHandler.sendMessage(msg); } else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage( - MSG_SIM_STATE_CHANGE, - new SimArgs(intent))); + MSG_SIM_STATE_CHANGE, SimArgs.fromIntent(intent))); } else if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_RINGER_MODE_CHANGED, intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE, -1), 0)); @@ -571,12 +575,16 @@ public class KeyguardUpdateMonitor { } /** - * Report that the user succesfully entered the sim pin or puk so we + * Report that the user successfully entered the SIM PIN or PUK/SIM PIN so we * have the information earlier than waiting for the intent * broadcast from the telephony code. + * + * NOTE: Because handleSimStateChange() invokes callbacks immediately without going + * through mHandler, this *must* be called from the UI thread. */ public void reportSimUnlocked() { mSimState = IccCard.State.READY; + handleSimStateChange(new SimArgs(mSimState)); } public boolean isKeyguardBypassEnabled() { diff --git a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java index 47a7157..0d1f436 100644 --- a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java @@ -242,20 +242,24 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen, new CheckSimPuk(mPukText.getText().toString(), mPinText.getText().toString()) { - void onSimLockChangedResponse(boolean success) { - if (mSimUnlockProgressDialog != null) { - mSimUnlockProgressDialog.hide(); - } - if (success) { - // before closing the keyguard, report back that - // the sim is unlocked so it knows right away - mUpdateMonitor.reportSimUnlocked(); - mCallback.goToUnlockScreen(); - } else { - mHeaderText.setText(R.string.badPuk); - mPukText.setText(""); - mPinText.setText(""); - } + void onSimLockChangedResponse(final boolean success) { + mPinText.post(new Runnable() { + public void run() { + if (mSimUnlockProgressDialog != null) { + mSimUnlockProgressDialog.hide(); + } + if (success) { + // before closing the keyguard, report back that + // the sim is unlocked so it knows right away + mUpdateMonitor.reportSimUnlocked(); + mCallback.goToUnlockScreen(); + } else { + mHeaderText.setText(R.string.badPuk); + mPukText.setText(""); + mPinText.setText(""); + } + } + }); } }.start(); } diff --git a/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java index 99e1ce1..f80637a 100644 --- a/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java @@ -214,21 +214,25 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie getSimUnlockProgressDialog().show(); new CheckSimPin(mPinText.getText().toString()) { - void onSimLockChangedResponse(boolean success) { - if (mSimUnlockProgressDialog != null) { - mSimUnlockProgressDialog.hide(); - } - if (success) { - // before closing the keyguard, report back that - // the sim is unlocked so it knows right away - mUpdateMonitor.reportSimUnlocked(); - mCallback.goToUnlockScreen(); - } else { - mHeaderText.setText(R.string.keyguard_password_wrong_pin_code); - mPinText.setText(""); - mEnteredDigits = 0; - } - mCallback.pokeWakelock(); + void onSimLockChangedResponse(final boolean success) { + mPinText.post(new Runnable() { + public void run() { + if (mSimUnlockProgressDialog != null) { + mSimUnlockProgressDialog.hide(); + } + if (success) { + // before closing the keyguard, report back that + // the sim is unlocked so it knows right away + mUpdateMonitor.reportSimUnlocked(); + mCallback.goToUnlockScreen(); + } else { + mHeaderText.setText(R.string.keyguard_password_wrong_pin_code); + mPinText.setText(""); + mEnteredDigits = 0; + } + mCallback.pokeWakelock(); + } + }); } }.start(); } |