Merge "Handle UNKNOWN sim state in KGVM." into udc-dev

This commit is contained in:
Aaron Liu
2023-06-09 18:01:52 +00:00
committed by Android (Google) Code Review
3 changed files with 16 additions and 2 deletions

View File

@@ -3668,7 +3668,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
mLogger.logSimState(subId, slotId, state);
boolean becameAbsent = false;
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
if (!SubscriptionManager.isValidSubscriptionId(subId)
&& state != TelephonyManager.SIM_STATE_UNKNOWN) {
mLogger.w("invalid subId in handleSimStateChange()");
/* Only handle No SIM(ABSENT) and Card Error(CARD_IO_ERROR) due to
* handleServiceStateChange() handle other case */
@@ -3703,7 +3704,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
data.subId = subId;
data.slotId = slotId;
}
if ((changed || becameAbsent) && state != TelephonyManager.SIM_STATE_UNKNOWN) {
if ((changed || becameAbsent) || state == TelephonyManager.SIM_STATE_UNKNOWN) {
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {

View File

@@ -697,6 +697,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
}
}
break;
case TelephonyManager.SIM_STATE_UNKNOWN:
mPendingPinLock = false;
break;
default:
if (DEBUG_SIM_STATES) Log.v(TAG, "Unspecific state: " + simState);
break;

View File

@@ -2800,6 +2800,16 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
);
}
@Test
public void testOnSimStateChanged_Unknown() {
KeyguardUpdateMonitorCallback keyguardUpdateMonitorCallback = spy(
KeyguardUpdateMonitorCallback.class);
mKeyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback);
mKeyguardUpdateMonitor.handleSimStateChange(-1, 0, TelephonyManager.SIM_STATE_UNKNOWN);
verify(keyguardUpdateMonitorCallback).onSimStateChanged(-1, 0,
TelephonyManager.SIM_STATE_UNKNOWN);
}
private void verifyFingerprintAuthenticateNeverCalled() {
verify(mFingerprintManager, never()).authenticate(any(), any(), any(), any(), any());
verify(mFingerprintManager, never()).authenticate(any(), any(), any(), any(), anyInt(),