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

Commit c63c1aff authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge "[Status Bar] Add CUJ tracking for opening the shade from the status bar." into udc-qpr-dev

parents cc969e1f 6126f098
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_IN
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_APP_LAUNCH_FROM_SETTINGS_BUTTON;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_CLEAR_ALL;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_DIALOG_OPEN;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_EXPAND_FROM_STATUS_BAR;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_HEADS_UP_APPEAR;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_HEADS_UP_DISAPPEAR;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_NOTIFICATION_ADD;
@@ -267,8 +268,9 @@ public class InteractionJankMonitor {
     * eg: Exit the app using back gesture.
     */
    public static final int CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK = 78;
    public static final int CUJ_SHADE_EXPAND_FROM_STATUS_BAR = 79;

    private static final int LAST_CUJ = CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK;
    private static final int LAST_CUJ = CUJ_SHADE_EXPAND_FROM_STATUS_BAR;
    private static final int NO_STATSD_LOGGING = -1;

    // Used to convert CujType to InteractionType enum value for statsd logging.
@@ -357,6 +359,7 @@ public class InteractionJankMonitor {
        CUJ_TO_STATSD_INTERACTION_TYPE[76] = NO_STATSD_LOGGING;
        CUJ_TO_STATSD_INTERACTION_TYPE[77] = NO_STATSD_LOGGING;
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK;
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_SHADE_EXPAND_FROM_STATUS_BAR] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_EXPAND_FROM_STATUS_BAR;
    }

    private static class InstanceHolder {
@@ -457,6 +460,7 @@ public class InteractionJankMonitor {
            CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION,
            CUJ_LAUNCHER_OPEN_SEARCH_RESULT,
            CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK,
            CUJ_SHADE_EXPAND_FROM_STATUS_BAR,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface CujType {
@@ -1070,6 +1074,8 @@ public class InteractionJankMonitor {
                return "LAUNCHER_OPEN_SEARCH_RESULT";
            case CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK:
                return "LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK";
            case CUJ_SHADE_EXPAND_FROM_STATUS_BAR:
                return "SHADE_EXPAND_FROM_STATUS_BAR";
        }
        return "UNKNOWN";
    }
+3 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@ public final class InteractionJankMonitorWrapper {
            InteractionJankMonitor.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS;
    public static final int CUJ_OPEN_SEARCH_RESULT =
            InteractionJankMonitor.CUJ_LAUNCHER_OPEN_SEARCH_RESULT;
    public static final int CUJ_SHADE_EXPAND_FROM_STATUS_BAR =
            InteractionJankMonitor.CUJ_SHADE_EXPAND_FROM_STATUS_BAR;

    @IntDef({
            CUJ_APP_LAUNCH_FROM_RECENTS,
@@ -76,6 +78,7 @@ public final class InteractionJankMonitorWrapper {
            CUJ_CLOSE_ALL_APPS_SWIPE,
            CUJ_CLOSE_ALL_APPS_TO_HOME,
            CUJ_OPEN_SEARCH_RESULT,
            CUJ_SHADE_EXPAND_FROM_STATUS_BAR,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface CujType {
+40 −4
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ import android.widget.FrameLayout;

import com.android.app.animation.Interpolators;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.policy.SystemBarUtils;
@@ -158,6 +157,7 @@ import com.android.systemui.plugins.qs.QS;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.shade.transition.ShadeTransitionController;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.GestureRecorder;
@@ -349,7 +349,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private final NotificationGutsManager mGutsManager;
    private final AlternateBouncerInteractor mAlternateBouncerInteractor;
    private final QuickSettingsController mQsController;
    private final InteractionJankMonitor mInteractionJankMonitor;
    private final TouchHandler mTouchHandler = new TouchHandler();

    private long mDownTime;
@@ -362,6 +361,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    /** The current squish amount for the predictive back animation */
    private float mCurrentBackProgress = 0.0f;
    private boolean mTracking;
    private boolean mIsTrackingExpansionFromStatusBar;
    private boolean mHintAnimationRunning;
    private KeyguardBottomAreaView mKeyguardBottomArea;
    private boolean mExpanding;
@@ -727,7 +727,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
            NotificationStackSizeCalculator notificationStackSizeCalculator,
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
            ShadeTransitionController shadeTransitionController,
            InteractionJankMonitor interactionJankMonitor,
            SystemClock systemClock,
            KeyguardBottomAreaViewModel keyguardBottomAreaViewModel,
            KeyguardBottomAreaInteractor keyguardBottomAreaInteractor,
@@ -746,7 +745,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
            ActivityStarter activityStarter,
            KeyguardViewConfigurator keyguardViewConfigurator,
            KeyguardFaceAuthInteractor keyguardFaceAuthInteractor) {
        mInteractionJankMonitor = interactionJankMonitor;
        keyguardStateController.addCallback(new KeyguardStateController.Callback() {
            @Override
            public void onKeyguardFadingAwayChanged() {
@@ -2666,6 +2664,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private void onTrackingStopped(boolean expand) {
        mFalsingCollector.onTrackingStopped();
        mTracking = false;
        maybeStopTrackingExpansionFromStatusBar(expand);

        updateExpansionAndVisibility();
        if (expand) {
            mNotificationStackScrollLayoutController.setOverScrollAmount(0.0f, true /* onTop */,
@@ -4036,6 +4036,42 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        return mTouchHandler.onTouchEvent(event);
    }

    @Override
    public void startTrackingExpansionFromStatusBar() {
        mIsTrackingExpansionFromStatusBar = true;
        InteractionJankMonitorWrapper.begin(
                mView, InteractionJankMonitorWrapper.CUJ_SHADE_EXPAND_FROM_STATUS_BAR);
    }

    /**
     * Stops tracking an expansion that originated from the status bar (if we had started tracking
     * it).
     *
     * @param expand the expand boolean passed to {@link #onTrackingStopped(boolean)}.
     */
    private void maybeStopTrackingExpansionFromStatusBar(boolean expand) {
        if (!mIsTrackingExpansionFromStatusBar) {
            return;
        }
        mIsTrackingExpansionFromStatusBar = false;

        // Determine whether the shade actually expanded due to the status bar touch:
        // - If the user just taps on the status bar, then #isExpanded is false but
        // #onTrackingStopped is called with `true`.
        // - If the user drags down on the status bar but doesn't drag down far enough, then
        // #onTrackingStopped is called with `false` but #isExpanded is true.
        // So, we need *both* #onTrackingStopped called with `true` *and* #isExpanded to be true in
        // order to confirm that the shade successfully opened.
        boolean shadeExpansionFromStatusBarSucceeded = expand && isExpanded();
        if (shadeExpansionFromStatusBarSucceeded) {
            InteractionJankMonitorWrapper.end(
                    InteractionJankMonitorWrapper.CUJ_SHADE_EXPAND_FROM_STATUS_BAR);
        } else {
            InteractionJankMonitorWrapper.cancel(
                    InteractionJankMonitorWrapper.CUJ_SHADE_EXPAND_FROM_STATUS_BAR);
        }
    }

    @Override
    public void updateTouchableRegion() {
        //A layout will ensure that onComputeInternalInsets will be called and after that we can
+3 −0
Original line number Diff line number Diff line
@@ -231,6 +231,9 @@ interface ShadeViewController {
    /** Sends an external (e.g. Status Bar) touch event to the Shade touch handler. */
    fun handleExternalTouch(event: MotionEvent): Boolean

    /** Starts tracking a shade expansion gesture that originated from the status bar. */
    fun startTrackingExpansionFromStatusBar()

    // ******* End Keyguard Section *********

    /** Returns the ShadeHeadsUpTracker. */
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ class PhoneStatusBarViewController private constructor(
                    shadeLogger.logMotionEvent(event, "top edge touch ignored")
                    return true
                }
                centralSurfaces.shadeViewController.startTrackingExpansionFromStatusBar()
            }
            return centralSurfaces.shadeViewController.handleExternalTouch(event)
        }
Loading