Add logging for bouncer dismissal reasons.
Bug: 128600267
Test: manual
Change-Id: I32728a713dcd282c9dcd881b5017657b2066fcc1
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
index 14df70c..94623f75 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -47,6 +47,17 @@
private static final int USER_TYPE_WORK_PROFILE = 2;
private static final int USER_TYPE_SECONDARY_USER = 3;
+ // Bouncer is dismissed due to no security.
+ private static final int BOUNCER_DISMISS_NONE_SECURITY = 0;
+ // Bouncer is dismissed due to pin, password or pattern entered.
+ private static final int BOUNCER_DISMISS_PASSWORD = 1;
+ // Bouncer is dismissed due to biometric (face, fingerprint or iris) authenticated.
+ private static final int BOUNCER_DISMISS_BIOMETRIC = 2;
+ // Bouncer is dismissed due to extended access granted.
+ private static final int BOUNCER_DISMISS_EXTENDED_ACCESS = 3;
+ // Bouncer is dismissed due to sim card unlock code entered.
+ private static final int BOUNCER_DISMISS_SIM = 4;
+
private KeyguardSecurityModel mSecurityModel;
private LockPatternUtils mLockPatternUtils;
@@ -327,12 +338,18 @@
if (DEBUG) Log.d(TAG, "showNextSecurityScreenOrFinish(" + authenticated + ")");
boolean finish = false;
boolean strongAuth = false;
- if (mUpdateMonitor.getUserCanSkipBouncer(targetUserId)) {
+ int eventSubtype = -1;
+ if (mUpdateMonitor.getUserHasTrust(targetUserId)) {
finish = true;
+ eventSubtype = BOUNCER_DISMISS_EXTENDED_ACCESS;
+ } else if (mUpdateMonitor.getUserUnlockedWithBiometric(targetUserId)) {
+ finish = true;
+ eventSubtype = BOUNCER_DISMISS_BIOMETRIC;
} else if (SecurityMode.None == mCurrentSecuritySelection) {
SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId);
if (SecurityMode.None == securityMode) {
finish = true; // no security required
+ eventSubtype = BOUNCER_DISMISS_NONE_SECURITY;
} else {
showSecurityScreen(securityMode); // switch to the alternate security view
}
@@ -343,6 +360,7 @@
case PIN:
strongAuth = true;
finish = true;
+ eventSubtype = BOUNCER_DISMISS_PASSWORD;
break;
case SimPin:
@@ -352,6 +370,7 @@
if (securityMode == SecurityMode.None || mLockPatternUtils.isLockScreenDisabled(
KeyguardUpdateMonitor.getCurrentUser())) {
finish = true;
+ eventSubtype = BOUNCER_DISMISS_SIM;
} else {
showSecurityScreen(securityMode);
}
@@ -363,6 +382,10 @@
break;
}
}
+ if (eventSubtype != -1) {
+ mMetricsLogger.write(new LogMaker(MetricsEvent.BOUNCER)
+ .setType(MetricsEvent.TYPE_DISMISS).setSubtype(eventSubtype));
+ }
if (finish) {
mSecurityCallback.finish(strongAuth, targetUserId);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 63f8cd6..fa39ccd 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -886,15 +886,22 @@
public boolean getUserCanSkipBouncer(int userId) {
- boolean fingerprintOrFace = mUserFingerprintAuthenticated.get(userId)
- || mUserFaceAuthenticated.get(userId);
- return getUserHasTrust(userId) || (fingerprintOrFace && isUnlockingWithBiometricAllowed());
+ return getUserHasTrust(userId) || getUserUnlockedWithBiometric(userId);
}
public boolean getUserHasTrust(int userId) {
return !isTrustDisabled(userId) && mUserHasTrust.get(userId);
}
+ /**
+ * Returns whether the user is unlocked with biometrics.
+ */
+ public boolean getUserUnlockedWithBiometric(int userId) {
+ boolean fingerprintOrFace = mUserFingerprintAuthenticated.get(userId)
+ || mUserFaceAuthenticated.get(userId);
+ return fingerprintOrFace && isUnlockingWithBiometricAllowed();
+ }
+
public boolean getUserTrustIsManaged(int userId) {
return mUserTrustIsManaged.get(userId) && !isTrustDisabled(userId);
}