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

Commit c10c16f0 authored by Andy Chou's avatar Andy Chou Committed by android-build-merger
Browse files

Merge "Fix Invalid SIM is not displayed for card error condition and add test...

Merge "Fix Invalid SIM is not displayed for card error condition and add test case testTelephonyCapable_SimState_CardIOError()" into qt-dev am: 0ab51714
am: a38e69d9

Change-Id: I6223791a9ef60ae320c685879333f364ba0c9793
parents 3f58eb04 a38e69d9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2004,7 +2004,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        boolean becameAbsent = false;
        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
            Log.w(TAG, "invalid subId in handleSimStateChange()");
            /* Only handle No SIM(ABSENT) due to handleServiceStateChange() handle other case */
            /* Only handle No SIM(ABSENT) and Card Error(CARD_IO_ERROR) due to
             * handleServiceStateChange() handle other case */
            if (state == State.ABSENT) {
                updateTelephonyCapable(true);
                // Even though the subscription is not valid anymore, we need to notify that the
@@ -2017,6 +2018,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
                        data.simState = State.ABSENT;
                    }
                }
            } else if (state == State.CARD_IO_ERROR) {
                updateTelephonyCapable(true);
            } else {
                return;
            }
+15 −4
Original line number Diff line number Diff line
@@ -143,10 +143,21 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
    @Test
    public void testTelephonyCapable_SimState_Absent() {
        Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
        intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE
                , IccCardConstants.INTENT_VALUE_ICC_ABSENT);
        mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
                , putPhoneInfo(intent,null, false));
        intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
                IccCardConstants.INTENT_VALUE_ICC_ABSENT);
        mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext(),
                putPhoneInfo(intent, null, false));
        mTestableLooper.processAllMessages();
        assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isTrue();
    }

    @Test
    public void testTelephonyCapable_SimState_CardIOError() {
        Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
        intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
                IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR);
        mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext(),
                putPhoneInfo(intent, null, false));
        mTestableLooper.processAllMessages();
        assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isTrue();
    }