Add latency tracking for checking PIN (1/2)
Also move tags to Keyguard as we need it in Keyguard.
Change-Id: I718581cb4081830da1c3a2f4ad9b9f0ec6f09ae5
diff --git a/packages/SystemUI/Android.mk b/packages/SystemUI/Android.mk
index 71bfe85..ffddf02 100644
--- a/packages/SystemUI/Android.mk
+++ b/packages/SystemUI/Android.mk
@@ -2,10 +2,9 @@
include $(CLEAR_VARS)
-LOCAL_MODULE := SystemUI-proto-tags
+LOCAL_MODULE := SystemUI-proto
-LOCAL_SRC_FILES := $(call all-proto-files-under,src) \
- src/com/android/systemui/EventLogTags.logtags
+LOCAL_SRC_FILES := $(call all-proto-files-under,src)
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors
@@ -33,7 +32,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
framework-protos \
- SystemUI-proto-tags
+ SystemUI-proto
LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_JAVA_LIBRARIES += android.car
diff --git a/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags b/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags
deleted file mode 100644
index d4149ea..0000000
--- a/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags
+++ /dev/null
@@ -1,68 +0,0 @@
-# See system/core/logcat/event.logtags for a description of the format of this file.
-
-option java_package com.android.systemui;
-
-# ---------------------------
-# PhoneStatusBar.java
-# ---------------------------
-36000 sysui_statusbar_touch (type|1),(x|1),(y|1),(disable1|1),(disable2|1)
-36001 sysui_heads_up_status (key|3),(visible|1)
-36002 sysui_fullscreen_notification (key|3)
-36003 sysui_heads_up_escalation (key|3)
-# sysui_status_bar_state: Logged whenever the status bar / keyguard state changes
-## state: 0: SHADE, 1: KEYGUARD, 2: SHADE_LOCKED
-## keyguardShowing: 1: Keyguard shown to the user (or keyguardOccluded)
-## keyguardOccluded: 1: Keyguard active, but another activity is occluding it
-## bouncerShowing: 1: Bouncer currently shown to the user
-## secure: 1: The user has set up a secure unlock method (PIN, password, etc.)
-## currentlyInsecure: 1: No secure unlock method set up (!secure), or trusted environment (TrustManager)
-36004 sysui_status_bar_state (state|1),(keyguardShowing|1),(keyguardOccluded|1),(bouncerShowing|1),(secure|1),(currentlyInsecure|1)
-
-# ---------------------------
-# PhoneStatusBarView.java
-# ---------------------------
-36010 sysui_panelbar_touch (type|1),(x|1),(y|1),(enabled|1)
-
-# ---------------------------
-# NotificationPanelView.java
-# ---------------------------
-36020 sysui_notificationpanel_touch (type|1),(x|1),(y|1)
-## type: 1: SWIPE_UP_UNLOCK Swiped up to dismiss the lockscreen.
-## 2: SWIPE_DOWN_FULL_SHADE Swiped down to enter full shade.
-## 3: TAP_UNLOCK_HINT Tapped in empty area, causes unlock hint.
-## 4: SWIPE_CAMERA Swiped the camera icon, launches.
-## 5: SWIPE_DIALER Swiped the dialer icon, launches.
-## 6: TAP_LOCK Tapped the (unlocked) lock icon, locks the device.
-## 7: TAP_NOTIFICATION_ACTIVATE Tapped a lockscreen notification, causes "tap again" hint.
-## Note: Second tap logged as notification_clicked.
-36021 sysui_lockscreen_gesture (type|1),(lengthDp|1),(velocityDp|1)
-
-# ---------------------------
-# SettingsPanelView.java
-# ---------------------------
-36030 sysui_quickpanel_touch (type|1),(x|1),(y|1)
-
-# ---------------------------
-# PanelHolder.java
-# ---------------------------
-36040 sysui_panelholder_touch (type|1),(x|1),(y|1)
-
-# ---------------------------
-# SearchPanelView.java
-# ---------------------------
-36050 sysui_searchpanel_touch (type|1),(x|1),(y|1)
-
-# ---------------------------
-# Recents.java, RecentsSystemUser.java
-# ---------------------------
-## type: 1: USER_BIND_SERVICE Secondary user tries binding to the system sysui service
-## 2: USER_SYSTEM_BOUND Secondary user is bound to the system sysui service
-## 3: USER_SYSTEM_UNBOUND Secondary user loses connection after system sysui has died
-## 4: SYSTEM_REGISTER_USER System sysui registers user's callbacks
-## 5: SYSTEM_UNREGISTER_USER System sysui unregisters user's callbacks (after death)
-36060 sysui_recents_connection (type|1),(user|1)
-
-# ---------------------------
-# LatencyTracker.java
-# ---------------------------
-36070 sysui_latency (action|1|5),(latency|1|3)
diff --git a/packages/SystemUI/src/com/android/systemui/LatencyTracker.java b/packages/SystemUI/src/com/android/systemui/LatencyTracker.java
deleted file mode 100644
index 0196815..0000000
--- a/packages/SystemUI/src/com/android/systemui/LatencyTracker.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.systemui;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Build;
-import android.os.Handler;
-import android.os.SystemClock;
-import android.os.SystemProperties;
-import android.os.Trace;
-import android.util.EventLog;
-import android.util.Log;
-import android.util.SparseLongArray;
-
-/**
- * Class to track various latencies in SystemUI. It then outputs the latency to logcat so these
- * latencies can be captured by tests and then used for dashboards.
- */
-public class LatencyTracker {
-
- private static final String ACTION_RELOAD_PROPERTY =
- "com.android.systemui.RELOAD_LATENCY_TRACKER_PROPERTY";
-
- private static final String TAG = "LatencyTracker";
-
- /**
- * Time it takes until the first frame of the notification panel to be displayed while expanding
- */
- public static final int ACTION_EXPAND_PANEL = 0;
-
- /**
- * Time it takes until the first frame of recents is drawn after invoking it with the button.
- */
- public static final int ACTION_TOGGLE_RECENTS = 1;
-
- /**
- * Time between we get a fingerprint acquired signal until we start with the unlock animation
- */
- public static final int ACTION_FINGERPRINT_WAKE_AND_UNLOCK = 2;
-
- private static final String[] NAMES = new String[] {
- "expand panel",
- "toggle recents",
- "fingerprint wake-and-unlock" };
-
- private static LatencyTracker sLatencyTracker;
-
- private final SparseLongArray mStartRtc = new SparseLongArray();
- private boolean mEnabled;
-
- public static LatencyTracker getInstance(Context context) {
- if (sLatencyTracker == null) {
- sLatencyTracker = new LatencyTracker(context);
- }
- return sLatencyTracker;
- }
-
- private LatencyTracker(Context context) {
- context.registerReceiver(new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- reloadProperty();
- }
- }, new IntentFilter(ACTION_RELOAD_PROPERTY));
- reloadProperty();
- }
-
- private void reloadProperty() {
- mEnabled = SystemProperties.getBoolean("debug.systemui.latency_tracking", false);
- }
-
- public static boolean isEnabled(Context ctx) {
- return Build.IS_DEBUGGABLE && getInstance(ctx).mEnabled;
- }
-
- /**
- * Notifies that an action is starting. This needs to be called from the main thread.
- *
- * @param action The action to start. One of the ACTION_* values.
- */
- public void onActionStart(int action) {
- if (!mEnabled) {
- return;
- }
- Trace.asyncTraceBegin(Trace.TRACE_TAG_APP, NAMES[action], 0);
- mStartRtc.put(action, SystemClock.elapsedRealtime());
- }
-
- /**
- * Notifies that an action has ended. This needs to be called from the main thread.
- *
- * @param action The action to end. One of the ACTION_* values.
- */
- public void onActionEnd(int action) {
- if (!mEnabled) {
- return;
- }
- long endRtc = SystemClock.elapsedRealtime();
- long startRtc = mStartRtc.get(action, -1);
- if (startRtc == -1) {
- return;
- }
- Trace.asyncTraceEnd(Trace.TRACE_TAG_APP, NAMES[action], 0);
- long duration = endRtc - startRtc;
- Log.i(TAG, "action=" + action + " latency=" + duration);
- EventLog.writeEvent(EventLogTags.SYSUI_LATENCY, action, (int) duration);
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index e5493b6..ec99d20 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -43,7 +43,7 @@
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.systemui.DejankUtils;
import com.android.systemui.Interpolators;
-import com.android.systemui.LatencyTracker;
+import com.android.keyguard.LatencyTracker;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.recents.events.EventBus;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
index 82867c6..c04ebb0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
@@ -30,7 +30,7 @@
import com.android.keyguard.KeyguardConstants;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.systemui.LatencyTracker;
+import com.android.keyguard.LatencyTracker;
import com.android.systemui.keyguard.KeyguardViewMediator;
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index c6aec73..3de03b5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -23,7 +23,6 @@
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.os.Trace;
import android.util.AttributeSet;
import android.util.Log;
import android.view.InputDevice;
@@ -37,7 +36,7 @@
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.Interpolators;
-import com.android.systemui.LatencyTracker;
+import com.android.keyguard.LatencyTracker;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.doze.DozeLog;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index a442fc0..7c47457 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -133,7 +133,7 @@
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.Interpolators;
-import com.android.systemui.LatencyTracker;
+import com.android.keyguard.LatencyTracker;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.SystemUIFactory;
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 01609e4..e3ede46 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -31,7 +31,7 @@
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.DejankUtils;
-import com.android.systemui.LatencyTracker;
+import com.android.keyguard.LatencyTracker;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.RemoteInputController;
diff --git a/packages/SystemUI/tests/Android.mk b/packages/SystemUI/tests/Android.mk
index 23967aa..6038171 100644
--- a/packages/SystemUI/tests/Android.mk
+++ b/packages/SystemUI/tests/Android.mk
@@ -45,7 +45,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-test \
mockito-target-minus-junit4 \
- SystemUI-proto-tags
+ SystemUI-proto \
+ SystemUI-tags
LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common android.car