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