Merge "DO NOT MERGE Show keyguard when SIM is removed" into nyc-mr2-dev

This commit is contained in:
TreeHugger Robot
2016-12-02 00:31:10 +00:00
committed by Android (Google) Code Review
2 changed files with 36 additions and 5 deletions

View File

@@ -63,6 +63,8 @@ import android.view.WindowManagerPolicy;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.policy.IKeyguardDrawnCallback; import com.android.internal.policy.IKeyguardDrawnCallback;
import com.android.internal.policy.IKeyguardExitCallback; import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardStateCallback; import com.android.internal.policy.IKeyguardStateCallback;
@@ -335,6 +337,7 @@ public class KeyguardViewMediator extends SystemUI {
private boolean mWakeAndUnlocking; private boolean mWakeAndUnlocking;
private IKeyguardDrawnCallback mDrawnCallback; private IKeyguardDrawnCallback mDrawnCallback;
private boolean mLockWhenSimRemoved;
private boolean mIsPerUserLock; private boolean mIsPerUserLock;
@@ -429,7 +432,7 @@ public class KeyguardViewMediator extends SystemUI {
case ABSENT: case ABSENT:
// only force lock screen in case of missing sim if user hasn't // only force lock screen in case of missing sim if user hasn't
// gone through setup wizard // gone through setup wizard
synchronized (this) { synchronized (KeyguardViewMediator.this) {
if (shouldWaitForProvisioning()) { if (shouldWaitForProvisioning()) {
if (!mShowing) { if (!mShowing) {
if (DEBUG_SIM_STATES) Log.d(TAG, "ICC_ABSENT isn't showing," if (DEBUG_SIM_STATES) Log.d(TAG, "ICC_ABSENT isn't showing,"
@@ -440,11 +443,12 @@ public class KeyguardViewMediator extends SystemUI {
resetStateLocked(); resetStateLocked();
} }
} }
onSimNotReadyLocked();
} }
break; break;
case PIN_REQUIRED: case PIN_REQUIRED:
case PUK_REQUIRED: case PUK_REQUIRED:
synchronized (this) { synchronized (KeyguardViewMediator.this) {
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 "
@@ -456,7 +460,7 @@ public class KeyguardViewMediator extends SystemUI {
} }
break; break;
case PERM_DISABLED: case PERM_DISABLED:
synchronized (this) { synchronized (KeyguardViewMediator.this) {
if (!mShowing) { if (!mShowing) {
if (DEBUG_SIM_STATES) Log.d(TAG, "PERM_DISABLED and " if (DEBUG_SIM_STATES) Log.d(TAG, "PERM_DISABLED and "
+ "keygaurd isn't showing."); + "keygaurd isn't showing.");
@@ -466,21 +470,40 @@ public class KeyguardViewMediator extends SystemUI {
+ "show permanently disabled message in lockscreen."); + "show permanently disabled message in lockscreen.");
resetStateLocked(); resetStateLocked();
} }
onSimNotReadyLocked();
} }
break; break;
case READY: case READY:
synchronized (this) { synchronized (KeyguardViewMediator.this) {
if (mShowing) { if (mShowing) {
resetStateLocked(); resetStateLocked();
} }
mLockWhenSimRemoved = true;
} }
break; break;
default: default:
if (DEBUG_SIM_STATES) Log.v(TAG, "Ignoring state: " + simState); if (DEBUG_SIM_STATES) Log.v(TAG, "Unspecific state: " + simState);
synchronized (KeyguardViewMediator.this) {
onSimNotReadyLocked();
}
break; break;
} }
} }
private void onSimNotReadyLocked() {
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");
doKeyguardLocked(null);
} else {
resetStateLocked();
}
}
}
@Override @Override
public void onFingerprintAuthFailed() { public void onFingerprintAuthFailed() {
final int currentUser = KeyguardUpdateMonitor.getCurrentUser(); final int currentUser = KeyguardUpdateMonitor.getCurrentUser();

View File

@@ -2213,6 +2213,14 @@ message MetricsEvent {
// ---- End N-MR1 Constants, all N-MR1 constants go above this line ---- // ---- End N-MR1 Constants, all N-MR1 constants go above this line ----
// ACTION: The lockscreen gets shown because the SIM card was removed
// SUBTYPE: false: device was previously unlocked, true: device was previously locked
// CATEGORY: GLOBAL_SYSTEM_UI
// OS: N-MR2
ACTION_LOCK_BECAUSE_SIM_REMOVED = 497;
// ---- End N-MR2 Constants, all N-MR2 constants go above this line ----
// Add new aosp constants above this line. // Add new aosp constants above this line.
// END OF AOSP CONSTANTS // END OF AOSP CONSTANTS
} }