Keyguard: Don't lock if SIM is NOT_READY

Fixes an issue with MVNOs where the lockscreen
would show in response to a virtual SIM switch.

Now we no longer lock with NOT_READY.

Change-Id: I520200311a5ae3218f1743b1fc9a568c39933ebf
Fixes: 33386149
Bug: 30997251
Test: Set up secure lockscreen, insert Fi SIM, dial *#*#346398#*#*, verify screen does not lock, eject SIM, verify screen locks.
This commit is contained in:
Adrian Roos
2016-12-13 12:07:09 -08:00
parent 52a9e0e1dd
commit e92de95261

View File

@@ -17,6 +17,8 @@
package com.android.systemui.keyguard;
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
import static com.android.internal.telephony.IccCardConstants.State.ABSENT;
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;
@@ -443,7 +445,11 @@ public class KeyguardViewMediator extends SystemUI {
resetStateLocked();
}
}
onSimNotReadyLocked();
if (simState == ABSENT) {
// MVNO SIMs can become transiently NOT_READY when switching networks,
// so we should only lock when they are ABSENT.
onSimAbsentLocked();
}
}
break;
case PIN_REQUIRED:
@@ -470,7 +476,7 @@ public class KeyguardViewMediator extends SystemUI {
+ "show permanently disabled message in lockscreen.");
resetStateLocked();
}
onSimNotReadyLocked();
onSimAbsentLocked();
}
break;
case READY:
@@ -484,22 +490,20 @@ public class KeyguardViewMediator extends SystemUI {
default:
if (DEBUG_SIM_STATES) Log.v(TAG, "Unspecific state: " + simState);
synchronized (KeyguardViewMediator.this) {
onSimNotReadyLocked();
onSimAbsentLocked();
}
break;
}
}
private void onSimNotReadyLocked() {
private void onSimAbsentLocked() {
if (isSecure() && mLockWhenSimRemoved) {
mLockWhenSimRemoved = false;
MetricsLogger.action(mContext,
MetricsEvent.ACTION_LOCK_BECAUSE_SIM_REMOVED, mShowing);
if (!mShowing) {
if (DEBUG_SIM_STATES) Log.d(TAG, "SIM removed, showing keyguard");
Log.i(TAG, "SIM removed, showing keyguard");
doKeyguardLocked(null);
} else {
resetStateLocked();
}
}
}
@@ -1246,7 +1250,7 @@ public class KeyguardViewMediator extends SystemUI {
// if the setup wizard hasn't run yet, don't show
final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim", false);
final boolean absent = SubscriptionManager.isValidSubscriptionId(
mUpdateMonitor.getNextSubIdForState(IccCardConstants.State.ABSENT));
mUpdateMonitor.getNextSubIdForState(ABSENT));
final boolean disabled = SubscriptionManager.isValidSubscriptionId(
mUpdateMonitor.getNextSubIdForState(IccCardConstants.State.PERM_DISABLED));
final boolean lockedOrMissing = mUpdateMonitor.isSimPinSecure()