diff options
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 |