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

Commit 1dbbbcbe 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
am: c10c16f0

Change-Id: I25e945ec14ae5b0ee9ccf5d523cf0b96fa4c6ec4
parents 504c77ba c10c16f0
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();
    }