diff options
| author | 2018-02-28 15:31:29 -0500 | |
|---|---|---|
| committer | 2018-03-02 10:21:15 -0500 | |
| commit | 404a85c467fa609289dffab5fb6523eda293e50b (patch) | |
| tree | 7b8c8efda026a2e150a1bfbf41bd8b59b83d6eaa | |
| parent | 90c27c332a7ac17cd190915a12529f66b03ec6cd (diff) | |
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
4 files changed, 62 insertions, 2 deletions
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 4d99a46e2321..27798203e4fe 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 @@ public class LockscreenGestureLogger { 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 6daabede7f32..9c2a0e5f96b9 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 @@ public abstract class PanelView extends FrameLayout { onTrackingStarted(); } if (isFullyCollapsed() && !mHeadsUpManager.hasPinnedHeadsUp()) { - startOpening(); + startOpening(event); } break; @@ -417,7 +417,7 @@ public abstract class PanelView extends FrameLayout { return !mGestureWaitForTouchSlop || mTracking; } - private void startOpening() {; + private void startOpening(MotionEvent event) { runPeekAnimation(INITIAL_OPENING_PEEK_DURATION, getOpeningHeight(), false /* collapseWhenFinished */); notifyBarPanelExpansionChanged(); @@ -425,6 +425,18 @@ public abstract class PanelView extends FrameLayout { 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 86e618e4690c..408cd85c29e9 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 @@ public class StatusBar extends SystemUI implements DemoMode, 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 6f31b0a22445..7819a80ec790 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -5348,6 +5348,27 @@ message MetricsEvent { // 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 |