diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java | 5 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java | 19 |
2 files changed, 19 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index ea8565e8d301..417cc68bb632 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -1994,7 +1994,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 @@ -2007,6 +2008,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { data.simState = State.ABSENT; } } + } else if (state == State.CARD_IO_ERROR) { + updateTelephonyCapable(true); } else { return; } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java index 6bed43eb37b6..6208ab82dda6 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java @@ -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(); } |