summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java')
-rwxr-xr-xpackages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java46
1 files changed, 25 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
index c87d628bb6b5..9f58a12c7e45 100755
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
@@ -16,6 +16,7 @@
package com.android.keyguard;
+import android.annotation.NonNull;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
@@ -26,6 +27,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
+import android.telephony.PinResult;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -35,7 +37,6 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
-import com.android.internal.telephony.PhoneConstants;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -141,11 +142,11 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
// Sending empty PIN here to query the number of remaining PIN attempts
new CheckSimPin("", mSubId) {
- void onSimCheckResponse(final int result, final int attemptsRemaining) {
- Log.d(LOG_TAG, "onSimCheckResponse " + " dummy One result" + result +
- " attemptsRemaining=" + attemptsRemaining);
- if (attemptsRemaining >= 0) {
- mRemainingAttempts = attemptsRemaining;
+ void onSimCheckResponse(final PinResult result) {
+ Log.d(LOG_TAG, "onSimCheckResponse " + " dummy One result "
+ + result.toString());
+ if (result.getAttemptsRemaining() >= 0) {
+ mRemainingAttempts = result.getAttemptsRemaining();
setLockedSimMessage();
}
}
@@ -261,7 +262,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
mSubId = subId;
}
- abstract void onSimCheckResponse(final int result, final int attemptsRemaining);
+ abstract void onSimCheckResponse(@NonNull PinResult result);
@Override
public void run() {
@@ -271,23 +272,23 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
TelephonyManager telephonyManager =
((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE))
.createForSubscriptionId(mSubId);
- final int[] result = telephonyManager.supplyPinReportResult(mPin);
- if (result == null || result.length == 0) {
+ final PinResult result = telephonyManager.supplyPinReportPinResult(mPin);
+ if (result == null) {
Log.e(TAG, "Error result for supplyPinReportResult.");
post(new Runnable() {
@Override
public void run() {
- onSimCheckResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1);
+ onSimCheckResponse(PinResult.getDefaultFailedResult());
}
});
} else {
if (DEBUG) {
- Log.v(TAG, "supplyPinReportResult returned: " + result[0] + " " + result[1]);
+ Log.v(TAG, "supplyPinReportResult returned: " + result.toString());
}
post(new Runnable() {
@Override
public void run() {
- onSimCheckResponse(result[0], result[1]);
+ onSimCheckResponse(result);
}
});
}
@@ -340,17 +341,18 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
if (mCheckSimPinThread == null) {
mCheckSimPinThread = new CheckSimPin(mPasswordEntry.getText(), mSubId) {
@Override
- void onSimCheckResponse(final int result, final int attemptsRemaining) {
+ void onSimCheckResponse(final PinResult result) {
post(new Runnable() {
@Override
public void run() {
- mRemainingAttempts = attemptsRemaining;
+ mRemainingAttempts = result.getAttemptsRemaining();
if (mSimUnlockProgressDialog != null) {
mSimUnlockProgressDialog.hide();
}
resetPasswordText(true /* animate */,
- result != PhoneConstants.PIN_RESULT_SUCCESS /* announce */);
- if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
+ /* announce */
+ result.getType() != PinResult.PIN_RESULT_TYPE_SUCCESS);
+ if (result.getType() == PinResult.PIN_RESULT_TYPE_SUCCESS) {
Dependency.get(KeyguardUpdateMonitor.class)
.reportSimUnlocked(mSubId);
mRemainingAttempts = -1;
@@ -360,14 +362,16 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
}
} else {
mShowDefaultMessage = false;
- if (result == PhoneConstants.PIN_PASSWORD_INCORRECT) {
- if (attemptsRemaining <= 2) {
+ if (result.getType() == PinResult.PIN_RESULT_TYPE_INCORRECT) {
+ if (result.getAttemptsRemaining() <= 2) {
// this is getting critical - show dialog
- getSimRemainingAttemptsDialog(attemptsRemaining).show();
+ getSimRemainingAttemptsDialog(
+ result.getAttemptsRemaining()).show();
} else {
// show message
mSecurityMessageDisplay.setMessage(
- getPinPasswordErrorMessage(attemptsRemaining, false));
+ getPinPasswordErrorMessage(
+ result.getAttemptsRemaining(), false));
}
} else {
// "PIN operation failed!" - no idea what this was and no way to
@@ -377,7 +381,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
}
if (DEBUG) Log.d(LOG_TAG, "verifyPasswordAndUnlock "
+ " CheckSimPin.onSimCheckResponse: " + result
- + " attemptsRemaining=" + attemptsRemaining);
+ + " attemptsRemaining=" + result.getAttemptsRemaining());
}
mCallback.userActivity();
mCheckSimPinThread = null;