Merge "Hide keyguard when SIM transitions to READY" am: 0ae1b444ca
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1590933 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I112188b6f78a650a551ebaed4a44e7d57c4ba892
This commit is contained in:
@@ -62,6 +62,7 @@ import android.telephony.TelephonyManager;
|
|||||||
import android.util.EventLog;
|
import android.util.EventLog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
import android.util.SparseBooleanArray;
|
||||||
import android.util.SparseIntArray;
|
import android.util.SparseIntArray;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -294,6 +295,13 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
*/
|
*/
|
||||||
private final SparseIntArray mLastSimStates = new SparseIntArray();
|
private final SparseIntArray mLastSimStates = new SparseIntArray();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if a SIM card had the SIM PIN enabled during the initialization, before
|
||||||
|
* reaching the SIM_STATE_READY state. The flag is reset to false at SIM_STATE_READY.
|
||||||
|
* Index is the slotId - in case of multiple SIM cards.
|
||||||
|
*/
|
||||||
|
private final SparseBooleanArray mSimWasLocked = new SparseBooleanArray();
|
||||||
|
|
||||||
private boolean mDeviceInteractive;
|
private boolean mDeviceInteractive;
|
||||||
private boolean mGoingToSleep;
|
private boolean mGoingToSleep;
|
||||||
|
|
||||||
@@ -465,10 +473,10 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean simWasLocked;
|
boolean lastSimStateWasLocked;
|
||||||
synchronized (KeyguardViewMediator.this) {
|
synchronized (KeyguardViewMediator.this) {
|
||||||
int lastState = mLastSimStates.get(slotId);
|
int lastState = mLastSimStates.get(slotId);
|
||||||
simWasLocked = (lastState == TelephonyManager.SIM_STATE_PIN_REQUIRED
|
lastSimStateWasLocked = (lastState == TelephonyManager.SIM_STATE_PIN_REQUIRED
|
||||||
|| lastState == TelephonyManager.SIM_STATE_PUK_REQUIRED);
|
|| lastState == TelephonyManager.SIM_STATE_PUK_REQUIRED);
|
||||||
mLastSimStates.append(slotId, simState);
|
mLastSimStates.append(slotId, simState);
|
||||||
}
|
}
|
||||||
@@ -492,17 +500,19 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
if (simState == TelephonyManager.SIM_STATE_ABSENT) {
|
if (simState == TelephonyManager.SIM_STATE_ABSENT) {
|
||||||
// MVNO SIMs can become transiently NOT_READY when switching networks,
|
// MVNO SIMs can become transiently NOT_READY when switching networks,
|
||||||
// so we should only lock when they are ABSENT.
|
// so we should only lock when they are ABSENT.
|
||||||
if (simWasLocked) {
|
if (lastSimStateWasLocked) {
|
||||||
if (DEBUG_SIM_STATES) Log.d(TAG, "SIM moved to ABSENT when the "
|
if (DEBUG_SIM_STATES) Log.d(TAG, "SIM moved to ABSENT when the "
|
||||||
+ "previous state was locked. Reset the state.");
|
+ "previous state was locked. Reset the state.");
|
||||||
resetStateLocked();
|
resetStateLocked();
|
||||||
}
|
}
|
||||||
|
mSimWasLocked.append(slotId, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TelephonyManager.SIM_STATE_PIN_REQUIRED:
|
case TelephonyManager.SIM_STATE_PIN_REQUIRED:
|
||||||
case TelephonyManager.SIM_STATE_PUK_REQUIRED:
|
case TelephonyManager.SIM_STATE_PUK_REQUIRED:
|
||||||
synchronized (KeyguardViewMediator.this) {
|
synchronized (KeyguardViewMediator.this) {
|
||||||
|
mSimWasLocked.append(slotId, true);
|
||||||
if (!mShowing) {
|
if (!mShowing) {
|
||||||
if (DEBUG_SIM_STATES) Log.d(TAG,
|
if (DEBUG_SIM_STATES) Log.d(TAG,
|
||||||
"INTENT_VALUE_ICC_LOCKED and keygaurd isn't "
|
"INTENT_VALUE_ICC_LOCKED and keygaurd isn't "
|
||||||
@@ -529,9 +539,10 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
case TelephonyManager.SIM_STATE_READY:
|
case TelephonyManager.SIM_STATE_READY:
|
||||||
synchronized (KeyguardViewMediator.this) {
|
synchronized (KeyguardViewMediator.this) {
|
||||||
if (DEBUG_SIM_STATES) Log.d(TAG, "READY, reset state? " + mShowing);
|
if (DEBUG_SIM_STATES) Log.d(TAG, "READY, reset state? " + mShowing);
|
||||||
if (mShowing && simWasLocked) {
|
if (mShowing && mSimWasLocked.get(slotId, false)) {
|
||||||
if (DEBUG_SIM_STATES) Log.d(TAG, "SIM moved to READY when the "
|
if (DEBUG_SIM_STATES) Log.d(TAG, "SIM moved to READY when the "
|
||||||
+ "previous state was locked. Reset the state.");
|
+ "previously was locked. Reset the state.");
|
||||||
|
mSimWasLocked.append(slotId, false);
|
||||||
resetStateLocked();
|
resetStateLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user