From 2508afecc713fecc9cb52879a097989f80c52c98 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Mon, 17 Sep 2018 17:17:14 -0700 Subject: [PATCH] Cherry-picked "Hide bouncer after unlocking SIM card" to pi-dev We don't want to hide the bouncer when the SIM card is READY, unless we were already at the bouncer because of the SIM PIN/PUK Test: Insert locked SIM card on lock screen or launcher. Type PIN Test: Insert unlocked SIM card after pulling up the bouncer Bug: 114740965, 120011429 Merged-In: I4f781b47c1e2a12e5c6f064f303cd457ece01b67 Change-Id: I4f781b47c1e2a12e5c6f064f303cd457ece01b67 --- .../systemui/keyguard/KeyguardViewMediator.java | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 01c6df9dc512..5409db7141d7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -20,6 +20,9 @@ import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT; import static android.view.Display.INVALID_DISPLAY; import static com.android.internal.telephony.IccCardConstants.State.ABSENT; +import static com.android.internal.telephony.IccCardConstants.State.PIN_REQUIRED; +import static com.android.internal.telephony.IccCardConstants.State.PUK_REQUIRED; +import static com.android.internal.telephony.IccCardConstants.State.READY; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT; @@ -56,6 +59,7 @@ import android.telephony.TelephonyManager; import android.util.EventLog; import android.util.Log; import android.util.Slog; +import android.util.SparseArray; import android.view.ViewGroup; import android.view.WindowManagerPolicyConstants; import android.view.animation.Animation; @@ -68,13 +72,13 @@ import com.android.internal.policy.IKeyguardDrawnCallback; import com.android.internal.policy.IKeyguardExitCallback; import com.android.internal.policy.IKeyguardStateCallback; import com.android.internal.telephony.IccCardConstants; +import com.android.internal.util.LatencyTracker; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardConstants; import com.android.keyguard.KeyguardDisplayManager; import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; -import com.android.internal.util.LatencyTracker; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.Dependency; import com.android.systemui.SystemUI; @@ -272,6 +276,12 @@ public class KeyguardViewMediator extends SystemUI { private KeyguardUpdateMonitor mUpdateMonitor; + /** + * Last SIM state reported by the telephony system. + * Index is the slotId - in case of multiple SIM cards. + */ + private final SparseArray mLastSimStates = new SparseArray<>(); + private boolean mDeviceInteractive; private boolean mGoingToSleep; @@ -448,6 +458,14 @@ public class KeyguardViewMediator extends SystemUI { } } + boolean simWasLocked; + synchronized (KeyguardViewMediator.this) { + IccCardConstants.State lastState = mLastSimStates.get(slotId); + simWasLocked = (lastState == PIN_REQUIRED || lastState == PUK_REQUIRED) + && simState == READY; + mLastSimStates.append(slotId, simState); + } + switch (simState) { case NOT_READY: case ABSENT: @@ -503,7 +521,8 @@ public class KeyguardViewMediator extends SystemUI { break; case READY: synchronized (KeyguardViewMediator.this) { - if (mShowing) { + if (DEBUG_SIM_STATES) Log.d(TAG, "READY, reset state? " + mShowing); + if (mShowing && simWasLocked) { resetStateLocked(); } mLockWhenSimRemoved = true; -- 2.11.0