Fix for 1785342: The old PIN is required after entering New PIN
State of dialogs was not properly maintained across pause/resume.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
@@ -24,15 +25,11 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO: Add a soft dialpad for PIN entry.
|
||||
*/
|
||||
class EditPinPreference extends EditTextPreference {
|
||||
|
||||
private boolean mDialogOpen;
|
||||
|
||||
interface OnPinEnteredListener {
|
||||
void onPinEntered(EditPinPreference preference, boolean positiveResult);
|
||||
}
|
||||
@@ -65,20 +62,22 @@ class EditPinPreference extends EditTextPreference {
|
||||
}
|
||||
|
||||
public boolean isDialogOpen() {
|
||||
return mDialogOpen;
|
||||
Dialog dialog = getDialog();
|
||||
return dialog != null && dialog.isShowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDialogClosed(boolean positiveResult) {
|
||||
super.onDialogClosed(positiveResult);
|
||||
mDialogOpen = false;
|
||||
if (mPinListener != null) {
|
||||
mPinListener.onPinEntered(this, positiveResult);
|
||||
}
|
||||
}
|
||||
|
||||
public void showPinDialog() {
|
||||
mDialogOpen = true;
|
||||
showDialog(null);
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog == null || !dialog.isShowing()) {
|
||||
showDialog(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -261,6 +261,9 @@ public class IccLockSettings extends PreferenceActivity
|
||||
mPinToggle.setChecked(!mToState);
|
||||
mDialogState = ICC_LOCK_MODE;
|
||||
showPinDialog();
|
||||
} else if (preference == mPinDialog) {
|
||||
mDialogState = ICC_OLD_MODE;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -277,7 +280,6 @@ public class IccLockSettings extends PreferenceActivity
|
||||
if (success) {
|
||||
mPinToggle.setChecked(mToState);
|
||||
} else {
|
||||
// TODO: I18N
|
||||
Toast.makeText(this, mRes.getString(R.string.sim_lock_failed), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
@@ -286,7 +288,6 @@ public class IccLockSettings extends PreferenceActivity
|
||||
|
||||
private void iccPinChanged(boolean success) {
|
||||
if (!success) {
|
||||
// TODO: I18N
|
||||
Toast.makeText(this, mRes.getString(R.string.sim_change_failed),
|
||||
Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
@@ -318,5 +319,6 @@ public class IccLockSettings extends PreferenceActivity
|
||||
mDialogState = ICC_OLD_MODE; // Default for when Change PIN is clicked
|
||||
mPin = "";
|
||||
setDialogValues();
|
||||
mDialogState = OFF_MODE;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user