Add LatencyTracker to track important SystemUI latencies for testing
Add a new class that can record latencies for various actions. Add a
new system property debug.systemui.latency_tracking to enable/disable
latency as well as a broadcast to reload the property if it changes.
This will be used to write lab latency tests to track important
transitions/latencies.
Change-Id: I11f96f1c410d83f2d3dbbdf903b29e3035744fb8
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 7bdb1c4..784d2ba 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -40,7 +40,9 @@
import com.android.internal.logging.MetricsLogger;
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.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.recents.events.EventBus;
@@ -187,6 +189,11 @@
public boolean onPreDraw() {
mRecentsView.getViewTreeObserver().removeOnPreDrawListener(this);
EventBus.getDefault().post(new RecentsDrawnEvent());
+ if (LatencyTracker.isEnabled(getApplicationContext())) {
+ DejankUtils.postAfterTraversal(() -> LatencyTracker.getInstance(
+ getApplicationContext()).onActionEnd(
+ LatencyTracker.ACTION_TOGGLE_RECENTS));
+ }
return true;
}
};