am e19ed435: Merge "Add explicit refererences and logging to KeyguardSim/Puk" into klp-dev

* commit 'e19ed43551bc1603a41f376883f69eeee12182f3':
  Add explicit refererences and logging to KeyguardSim/Puk
This commit is contained in:
Jim Miller
2013-11-04 19:21:32 -08:00
committed by Android Git Automerger
2 changed files with 20 additions and 13 deletions

View File

@@ -46,9 +46,10 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
private static final String LOG_TAG = "KeyguardSimPinView";
private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
public static final String TAG = "KeyguardSimPinView";
private ProgressDialog mSimUnlockProgressDialog = null;
private volatile boolean mSimCheckInProgress;
private CheckSimPin mCheckSimPinThread;
private AlertDialog mRemainingAttemptsDialog;
@@ -169,14 +170,17 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
@Override
public void run() {
try {
Log.v(TAG, "call supplyPinReportResult()");
final int[] result = ITelephony.Stub.asInterface(ServiceManager
.checkService("phone")).supplyPinReportResult(mPin);
Log.v(TAG, "supplyPinReportResult returned: " + result[0] + " " + result[1]);
post(new Runnable() {
public void run() {
onSimCheckResponse(result[0], result[1]);
}
});
} catch (RemoteException e) {
Log.e(TAG, "RemoteException for supplyPinReportResult:", e);
post(new Runnable() {
public void run() {
onSimCheckResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1);
@@ -229,9 +233,8 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
getSimUnlockProgressDialog().show();
if (!mSimCheckInProgress) {
mSimCheckInProgress = true; // there should be only one
new CheckSimPin(mPasswordEntry.getText().toString()) {
if (mCheckSimPinThread == null) {
mCheckSimPinThread = new CheckSimPin(mPasswordEntry.getText().toString()) {
void onSimCheckResponse(final int result, final int attemptsRemaining) {
post(new Runnable() {
public void run() {
@@ -263,11 +266,12 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
mPasswordEntry.setText("");
}
mCallback.userActivity(0);
mSimCheckInProgress = false;
mCheckSimPinThread = null;
}
});
}
}.start();
};
mCheckSimPinThread.start();
}
}
}

View File

@@ -45,9 +45,10 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
private static final String LOG_TAG = "KeyguardSimPukView";
private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
public static final String TAG = "KeyguardSimPukView";
private ProgressDialog mSimUnlockProgressDialog = null;
private volatile boolean mCheckInProgress;
private CheckSimPuk mCheckSimPukThread;
private String mPukText;
private String mPinText;
private StateMachine mStateMachine = new StateMachine();
@@ -220,15 +221,17 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
@Override
public void run() {
try {
Log.v(TAG, "call supplyPukReportResult()");
final int[] result = ITelephony.Stub.asInterface(ServiceManager
.checkService("phone")).supplyPukReportResult(mPuk, mPin);
Log.v(TAG, "supplyPukReportResult returned: " + result[0] + " " + result[1]);
post(new Runnable() {
public void run() {
onSimLockChangedResponse(result[0], result[1]);
}
});
} catch (RemoteException e) {
Log.e(TAG, "RemoteException for supplyPukReportResult:", e);
post(new Runnable() {
public void run() {
onSimLockChangedResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1);
@@ -295,9 +298,8 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
private void updateSim() {
getSimUnlockProgressDialog().show();
if (!mCheckInProgress) {
mCheckInProgress = true;
new CheckSimPuk(mPukText, mPinText) {
if (mCheckSimPukThread == null) {
mCheckSimPukThread = new CheckSimPuk(mPukText, mPinText) {
void onSimLockChangedResponse(final int result, final int attemptsRemaining) {
post(new Runnable() {
public void run() {
@@ -326,11 +328,12 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
+ " attemptsRemaining=" + attemptsRemaining);
mStateMachine.reset();
}
mCheckInProgress = false;
mCheckSimPukThread = null;
}
});
}
}.start();
};
mCheckSimPukThread.start();
}
}