From 2e0d4959ea3962f604bdceb79cd0f097cc3e0562 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Wed, 5 Dec 2018 20:03:53 -0800 Subject: [PATCH] Hide SIM PIN when SIM card is removed Test: manually add and remove SIM card Change-Id: Ied7666c2f6c1febe5690e4531b76b58a4f703d86 Fixes: 119587536 --- .../src/com/android/keyguard/KeyguardUpdateMonitor.java | 9 +++++++-- .../android/systemui/keyguard/KeyguardViewMediator.java | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index b55aa5c8897d2..904f94486e6cd 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -1904,13 +1904,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { + slotId + ", state=" + state +")"); } + 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 */ if (state == State.ABSENT) { updateTelephonyCapable(true); + // Even though the subscription is not valid anymore, we need to notify that the + // SIM card was removed so we can update the UI. + becameAbsent = true; + } else { + return; } - return; } SimData data = mSimDatas.get(subId); @@ -1925,7 +1930,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { data.subId = subId; data.slotId = slotId; } - if (changed && state != State.UNKNOWN) { + if ((changed || becameAbsent) && state != State.UNKNOWN) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 3b9110d31c6fa..9ccdf79c37cab 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -488,6 +488,9 @@ public class KeyguardViewMediator extends SystemUI { // MVNO SIMs can become transiently NOT_READY when switching networks, // so we should only lock when they are ABSENT. onSimAbsentLocked(); + if (simWasLocked) { + resetStateLocked(); + } } } break;