Merge "Fix 5620754: don't show pattern screen after SIM PUK unlock" into ics-mr1
This commit is contained in:
@@ -110,10 +110,14 @@ public class KeyguardUpdateMonitor {
|
|||||||
* the intent and provide a {@link SimCard.State} result.
|
* the intent and provide a {@link SimCard.State} result.
|
||||||
*/
|
*/
|
||||||
private static class SimArgs {
|
private static class SimArgs {
|
||||||
|
|
||||||
public final IccCard.State simState;
|
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())) {
|
if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) {
|
||||||
throw new IllegalArgumentException("only handles intent ACTION_SIM_STATE_CHANGED");
|
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(
|
if (IccCard.INTENT_VALUE_ABSENT_ON_PERM_DISABLED.equals(
|
||||||
absentReason)) {
|
absentReason)) {
|
||||||
this.simState = IccCard.State.PERM_DISABLED;
|
state = IccCard.State.PERM_DISABLED;
|
||||||
} else {
|
} else {
|
||||||
this.simState = IccCard.State.ABSENT;
|
state = IccCard.State.ABSENT;
|
||||||
}
|
}
|
||||||
} else if (IccCard.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
|
} 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)) {
|
} else if (IccCard.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
|
||||||
final String lockedReason = intent
|
final String lockedReason = intent
|
||||||
.getStringExtra(IccCard.INTENT_KEY_LOCKED_REASON);
|
.getStringExtra(IccCard.INTENT_KEY_LOCKED_REASON);
|
||||||
if (IccCard.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) {
|
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)) {
|
} else if (IccCard.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) {
|
||||||
this.simState = IccCard.State.PUK_REQUIRED;
|
state = IccCard.State.PUK_REQUIRED;
|
||||||
} else {
|
} else {
|
||||||
this.simState = IccCard.State.UNKNOWN;
|
state = IccCard.State.UNKNOWN;
|
||||||
}
|
}
|
||||||
} else if (IccCard.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) {
|
} else if (IccCard.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) {
|
||||||
this.simState = IccCard.State.NETWORK_LOCKED;
|
state = IccCard.State.NETWORK_LOCKED;
|
||||||
} else {
|
} else {
|
||||||
this.simState = IccCard.State.UNKNOWN;
|
state = IccCard.State.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
return new SimArgs(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@@ -279,8 +284,7 @@ public class KeyguardUpdateMonitor {
|
|||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
} else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) {
|
} else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) {
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(
|
mHandler.sendMessage(mHandler.obtainMessage(
|
||||||
MSG_SIM_STATE_CHANGE,
|
MSG_SIM_STATE_CHANGE, SimArgs.fromIntent(intent)));
|
||||||
new SimArgs(intent)));
|
|
||||||
} else if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(action)) {
|
} else if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(action)) {
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(MSG_RINGER_MODE_CHANGED,
|
mHandler.sendMessage(mHandler.obtainMessage(MSG_RINGER_MODE_CHANGED,
|
||||||
intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE, -1), 0));
|
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
|
* have the information earlier than waiting for the intent
|
||||||
* broadcast from the telephony code.
|
* 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() {
|
public void reportSimUnlocked() {
|
||||||
mSimState = IccCard.State.READY;
|
mSimState = IccCard.State.READY;
|
||||||
|
handleSimStateChange(new SimArgs(mSimState));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isKeyguardBypassEnabled() {
|
public boolean isKeyguardBypassEnabled() {
|
||||||
|
|||||||
@@ -242,20 +242,24 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
|||||||
|
|
||||||
new CheckSimPuk(mPukText.getText().toString(),
|
new CheckSimPuk(mPukText.getText().toString(),
|
||||||
mPinText.getText().toString()) {
|
mPinText.getText().toString()) {
|
||||||
void onSimLockChangedResponse(boolean success) {
|
void onSimLockChangedResponse(final boolean success) {
|
||||||
if (mSimUnlockProgressDialog != null) {
|
mPinText.post(new Runnable() {
|
||||||
mSimUnlockProgressDialog.hide();
|
public void run() {
|
||||||
}
|
if (mSimUnlockProgressDialog != null) {
|
||||||
if (success) {
|
mSimUnlockProgressDialog.hide();
|
||||||
// before closing the keyguard, report back that
|
}
|
||||||
// the sim is unlocked so it knows right away
|
if (success) {
|
||||||
mUpdateMonitor.reportSimUnlocked();
|
// before closing the keyguard, report back that
|
||||||
mCallback.goToUnlockScreen();
|
// the sim is unlocked so it knows right away
|
||||||
} else {
|
mUpdateMonitor.reportSimUnlocked();
|
||||||
mHeaderText.setText(R.string.badPuk);
|
mCallback.goToUnlockScreen();
|
||||||
mPukText.setText("");
|
} else {
|
||||||
mPinText.setText("");
|
mHeaderText.setText(R.string.badPuk);
|
||||||
}
|
mPukText.setText("");
|
||||||
|
mPinText.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,21 +214,25 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
|
|||||||
getSimUnlockProgressDialog().show();
|
getSimUnlockProgressDialog().show();
|
||||||
|
|
||||||
new CheckSimPin(mPinText.getText().toString()) {
|
new CheckSimPin(mPinText.getText().toString()) {
|
||||||
void onSimLockChangedResponse(boolean success) {
|
void onSimLockChangedResponse(final boolean success) {
|
||||||
if (mSimUnlockProgressDialog != null) {
|
mPinText.post(new Runnable() {
|
||||||
mSimUnlockProgressDialog.hide();
|
public void run() {
|
||||||
}
|
if (mSimUnlockProgressDialog != null) {
|
||||||
if (success) {
|
mSimUnlockProgressDialog.hide();
|
||||||
// before closing the keyguard, report back that
|
}
|
||||||
// the sim is unlocked so it knows right away
|
if (success) {
|
||||||
mUpdateMonitor.reportSimUnlocked();
|
// before closing the keyguard, report back that
|
||||||
mCallback.goToUnlockScreen();
|
// the sim is unlocked so it knows right away
|
||||||
} else {
|
mUpdateMonitor.reportSimUnlocked();
|
||||||
mHeaderText.setText(R.string.keyguard_password_wrong_pin_code);
|
mCallback.goToUnlockScreen();
|
||||||
mPinText.setText("");
|
} else {
|
||||||
mEnteredDigits = 0;
|
mHeaderText.setText(R.string.keyguard_password_wrong_pin_code);
|
||||||
}
|
mPinText.setText("");
|
||||||
mCallback.pokeWakelock();
|
mEnteredDigits = 0;
|
||||||
|
}
|
||||||
|
mCallback.pokeWakelock();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user