From a5bea739cb43ea3288c7b10fe132b0665caabb0d Mon Sep 17 00:00:00 2001 From: thiruram Date: Fri, 24 Apr 2020 14:21:00 -0700 Subject: [PATCH] Migrates LOCKSCREEN and BOUNCER logs from TRON to Westworld Bug: 147509048 Test: Manual, `lunch coral-userdebug && make -j100` Change-Id: Ic096e81603d343d4a4bfc5867113b658744c56ff --- .../systemui/statusbar/phone/StatusBar.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 420b75c688abe..a2afd9c2d52b7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -116,6 +116,9 @@ import android.widget.DateTimeView; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.logging.MetricsLogger; +import com.android.internal.logging.UiEvent; +import com.android.internal.logging.UiEventLogger; +import com.android.internal.logging.UiEventLoggerImpl; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.RegisterStatusBarResult; @@ -301,6 +304,8 @@ public class StatusBar extends SystemUI implements DemoMode, /** If true, the lockscreen will show a distinct wallpaper */ public static final boolean ENABLE_LOCKSCREEN_WALLPAPER = true; + private static final UiEventLogger sUiEventLogger = new UiEventLoggerImpl(); + static { boolean onlyCoreApps; try { @@ -459,6 +464,44 @@ public class StatusBar extends SystemUI implements DemoMode, } }; + @VisibleForTesting + public enum StatusBarUiEvent implements UiEventLogger.UiEventEnum { + @UiEvent(doc = "Secured lockscreen is opened.") + LOCKSCREEN_OPEN_SECURE(405), + + @UiEvent(doc = "Lockscreen without security is opened.") + LOCKSCREEN_OPEN_INSECURE(406), + + @UiEvent(doc = "Secured lockscreen is closed.") + LOCKSCREEN_CLOSE_SECURE(407), + + @UiEvent(doc = "Lockscreen without security is closed.") + LOCKSCREEN_CLOSE_INSECURE(408), + + @UiEvent(doc = "Secured bouncer is opened.") + BOUNCER_OPEN_SECURE(409), + + @UiEvent(doc = "Bouncer without security is opened.") + BOUNCER_OPEN_INSECURE(410), + + @UiEvent(doc = "Secured bouncer is closed.") + BOUNCER_CLOSE_SECURE(411), + + @UiEvent(doc = "Bouncer without security is closed.") + BOUNCER_CLOSE_INSECURE(412); + + private final int mId; + + StatusBarUiEvent(int id) { + mId = id; + } + + @Override + public int getId() { + return mId; + } + } + protected final H mHandler = createHandler(); private int mInteractingWindows; @@ -2909,6 +2952,12 @@ public class StatusBar extends SystemUI implements DemoMode, isSecure ? 1 : 0, unlocked ? 1 : 0); mLastLoggedStateFingerprint = stateFingerprint; + + StringBuilder uiEventValueBuilder = new StringBuilder(); + uiEventValueBuilder.append(isBouncerShowing ? "BOUNCER" : "LOCKSCREEN"); + uiEventValueBuilder.append(isShowing ? "_OPEN" : "_CLOSE"); + uiEventValueBuilder.append(isSecure ? "_SECURE" : "_INSECURE"); + sUiEventLogger.log(StatusBarUiEvent.valueOf(uiEventValueBuilder.toString())); } }