Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 189ba590 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Log some data when the QS panel starts expanding"

parents ac263ac4 404a85c4
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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) {
+14 −2
Original line number Diff line number Diff line
@@ -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();
+12 −0
Original line number Diff line number Diff line
@@ -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,
+21 −0
Original line number Diff line number Diff line
@@ -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