Log some data when the QS panel starts expanding
The main goal is to learn at what x-position users tend to swipe down to
pull the notification/qs shade. To do that, this CL logs the following
data:
- x-location (as 0-100 percent)
- y-location (same)
- device rotation
in PanelView#startOpening(). This should only be logged rarely enough
(once per qs pull) not to spam logs or have any performance impact.
It also currently doesn't collect any data when expanding qs from the
keyguard, but I'm assuming that that particular case is much less
common. Logging could be added later though.
Fixes: 74012876
Test: adb logcat -b events | grep sysui_multi_action; pull notification
shade when device is unlocked and see lines like this:
02-28 12:41:42.060 31783 31783 I sysui_multi_action: [757,1324,758,4,826,413,827,12769,1322,91,1323,0,1325,0]
Change-Id: I9154a808552656d3fe02b1a8f732a4fbba3b09e6
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java
index 4d99a46..2779820 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java
@@ -52,6 +52,21 @@
EventLogTags.writeSysuiLockscreenGesture(safeLookup(gesture), length, velocity);
}
+ /**
+ * Record the location of a swipe gesture, expressed as percentages of the whole screen
+ * @param category the action
+ * @param xPercent x-location / width * 100
+ * @param yPercent y-location / height * 100
+ */
+ public void writeAtFractionalPosition(
+ int category, int xPercent, int yPercent, int rotation) {
+ mMetricsLogger.write(mLogMaker.setCategory(category)
+ .setType(MetricsEvent.TYPE_ACTION)
+ .addTaggedData(MetricsEvent.FIELD_GESTURE_X_PERCENT, xPercent)
+ .addTaggedData(MetricsEvent.FIELD_GESTURE_Y_PERCENT, yPercent)
+ .addTaggedData(MetricsEvent.FIELD_DEVICE_ROTATION, rotation));
+ }
+
private int safeLookup(int gesture) {
Integer value = mLegacyMap.get(gesture);
if (value == null) {
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 6daabed..9c2a0e5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -342,7 +342,7 @@
onTrackingStarted();
}
if (isFullyCollapsed() && !mHeadsUpManager.hasPinnedHeadsUp()) {
- startOpening();
+ startOpening(event);
}
break;
@@ -417,7 +417,7 @@
return !mGestureWaitForTouchSlop || mTracking;
}
- private void startOpening() {;
+ private void startOpening(MotionEvent event) {
runPeekAnimation(INITIAL_OPENING_PEEK_DURATION, getOpeningHeight(),
false /* collapseWhenFinished */);
notifyBarPanelExpansionChanged();
@@ -425,6 +425,18 @@
AsyncTask.execute(() ->
mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_TICK, false)));
}
+
+ //TODO: keyguard opens QS a different way; log that too?
+
+ // Log the position of the swipe that opened the panel
+ float width = mStatusBar.getDisplayWidth();
+ float height = mStatusBar.getDisplayHeight();
+ int rot = mStatusBar.getRotation();
+
+ mLockscreenGestureLogger.writeAtFractionalPosition(MetricsEvent.ACTION_PANEL_VIEW_EXPAND,
+ (int) (event.getX() / width * 100),
+ (int) (event.getY() / height * 100),
+ rot);
}
protected abstract float getOpeningHeight();
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 86e618e..408cd85 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -2834,6 +2834,18 @@
return mDisplayMetrics.density;
}
+ float getDisplayWidth() {
+ return mDisplayMetrics.widthPixels;
+ }
+
+ float getDisplayHeight() {
+ return mDisplayMetrics.heightPixels;
+ }
+
+ int getRotation() {
+ return mDisplay.getRotation();
+ }
+
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
boolean dismissShade) {
startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade,
diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto
index 6f31b0a..7819a80 100644
--- a/proto/src/metrics_constants.proto
+++ b/proto/src/metrics_constants.proto
@@ -5348,6 +5348,27 @@
// OS: P
RECENT_LOCATION_REQUESTS_ALL = 1325;
+ // FIELD: The x-location of a swipe gesture, conveyed as percent of total width
+ // CATEGORY: GLOBAL_SYSTEM_UI
+ // OS: P
+ FIELD_GESTURE_X_PERCENT = 1326;
+
+ // FIELD: The y-location of a swipe gesture, conveyed as percent of total width
+ // CATEGORY: GLOBAL_SYSTEM_UI
+ // OS: P
+ FIELD_GESTURE_Y_PERCENT = 1327;
+
+ // ACTION: Expand the notification panel while unlocked
+ // CATEGORY: GLOBAL_SYSTEM_UI
+ // OS: P
+ ACTION_PANEL_VIEW_EXPAND = 1328;
+
+
+ // FIELD: Rotation of the device
+ // CATEGORY: GLOBAL_SYSTEM_UI
+ // OS: P
+ FIELD_DEVICE_ROTATION = 1329;
+
// ---- End P Constants, all P constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS