Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6be5cd2b authored by Aaron Liu's avatar Aaron Liu Committed by Android (Google) Code Review
Browse files

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

parents b541d4cd fb1db79c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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) {
+3 −0
Original line number Diff line number Diff line
@@ -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;
+10 −0
Original line number Diff line number Diff line
@@ -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(),