diff options
author | Steven Laver <lavers@google.com> | 2020-01-23 17:03:21 -0800 |
---|---|---|
committer | Steven Laver <lavers@google.com> | 2020-02-04 23:22:55 +0000 |
commit | 71998c3d8b36220df1be12fe6e1ba7eda81cde41 (patch) | |
tree | 8b5e07fadfa5561f430abd298094046a496c3fb3 /packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java | |
parent | 4307c64762e7fd78e8cdd955296655d51a6094e2 (diff) | |
parent | db0ac39741da692dddac3ff31aa87634af92e1e8 (diff) |
Merge RP1A.200123.001
Change-Id: I16a4437d9876db7a6a2b07231b4584df4564bee4
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java')
-rwxr-xr-x | packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java | 46 |
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; |