Atoms: Keygaurd and Bouncer
Logs changes in the state of the keyguard and the keyguard bouncer
Test: verified logs appear in adb logcat -b stats
Change-Id: I1ffdf72ab088318c883197b3e1eb283bec2b8b2a
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 1c1d16b..a98ad59 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -101,6 +101,9 @@
OverlayStateChanged overlay_state_changed = 59;
ForegroundServiceStateChanged foreground_service_state_changed = 60;
CallStateChanged call_state_changed = 61;
+ KeyguardStateChanged keyguard_state_changed = 62;
+ KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
+ KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
// TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
}
@@ -747,6 +750,63 @@
}
/**
+ * Logs keyguard state. The keyguard is the lock screen.
+ *
+ * Logged from:
+ * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+ */
+message KeyguardStateChanged {
+ enum State {
+ UNKNOWN = 0;
+ // The keyguard is hidden when the phone is unlocked.
+ HIDDEN = 1;
+ // The keyguard is shown when the phone is locked (screen turns off).
+ SHOWN= 2;
+ // The keyguard is occluded when something is overlaying the keyguard.
+ // Eg. Opening the camera while on the lock screen.
+ OCCLUDED = 3;
+ }
+ optional State state = 1;
+}
+
+/**
+ * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
+ * prompts the user to enter a password (pattern, pin, etc).
+ *
+ * Logged from:
+ * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+ */
+
+message KeyguardBouncerStateChanged {
+ enum State {
+ UNKNOWN = 0;
+ // Bouncer is hidden, either as a result of successfully entering the
+ // password, screen timing out, or user going back to lock screen.
+ HIDDEN = 1;
+ // This is when the user is being prompted to enter the password.
+ SHOWN = 2;
+ }
+ optional State state = 1;
+}
+
+/**
+ * Logs the result of entering a password into the keyguard bouncer.
+ *
+ * Logged from:
+ * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
+ */
+message KeyguardBouncerPasswordEntered {
+ enum BouncerResult {
+ UNKNOWN = 0;
+ // The password entered was incorrect.
+ FAILURE = 1;
+ // The password entered was correct.
+ SUCCESS = 2;
+ }
+ optional BouncerResult result = 1;
+}
+
+/**
* Logs the duration of a davey (jank of >=700ms) when it occurs
*
* Logged from:
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
index c3413d9..cb5a050 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -25,6 +25,7 @@
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
+import android.util.StatsLog;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
@@ -430,9 +431,13 @@
public void reportUnlockAttempt(int userId, boolean success, int timeoutMs) {
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
if (success) {
+ StatsLog.write(StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED,
+ StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__SUCCESS);
monitor.clearFailedUnlockAttempts();
mLockPatternUtils.reportSuccessfulPasswordAttempt(userId);
} else {
+ StatsLog.write(StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED,
+ StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__FAILURE);
KeyguardSecurityContainer.this.reportFailedUnlockAttempt(userId, timeoutMs);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index 380c08e..edfbd3f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -21,6 +21,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Slog;
+import android.util.StatsLog;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@@ -152,6 +153,8 @@
mKeyguardView.requestLayout();
}
mShowingSoon = false;
+ StatsLog.write(StatsLog.KEYGUARD_BOUNCER_STATE_CHANGED,
+ StatsLog.KEYGUARD_BOUNCER_STATE_CHANGED__STATE__SHOWN);
}
};
@@ -183,6 +186,8 @@
public void hide(boolean destroyView) {
if (isShowing()) {
+ StatsLog.write(StatsLog.KEYGUARD_BOUNCER_STATE_CHANGED,
+ StatsLog.KEYGUARD_BOUNCER_STATE_CHANGED__STATE__HIDDEN);
mDismissCallbackRegistry.notifyDismissCancelled();
}
mFalsingManager.onBouncerHidden();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 47ea3a7..49cffc0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -24,6 +24,7 @@
import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
+import android.util.StatsLog;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -140,6 +141,8 @@
mShowing = true;
mStatusBarWindowManager.setKeyguardShowing(true);
reset(true /* hideBouncerWhenShowing */);
+ StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
+ StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
}
/**
@@ -289,6 +292,8 @@
public void setOccluded(boolean occluded, boolean animate) {
mStatusBar.setOccluded(occluded);
if (occluded && !mOccluded && mShowing) {
+ StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
+ StatsLog.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED);
if (mStatusBar.isInLaunchTransition()) {
mOccluded = true;
mStatusBar.fadeKeyguardAfterLaunchTransition(null /* beforeFading */,
@@ -301,6 +306,9 @@
});
return;
}
+ } else if (!occluded && mOccluded && mShowing) {
+ StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
+ StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
}
boolean isOccluding = !mOccluded && occluded;
mOccluded = occluded;
@@ -398,6 +406,8 @@
mStatusBarWindowManager.setKeyguardShowing(false);
mViewMediatorCallback.keyguardGone();
}
+ StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
+ StatsLog.KEYGUARD_STATE_CHANGED__STATE__HIDDEN);
}
public void onDensityOrFontScaleChanged() {