diff options
6 files changed, 54 insertions, 6 deletions
diff --git a/core/java/com/android/internal/jank/InteractionJankMonitor.java b/core/java/com/android/internal/jank/InteractionJankMonitor.java index 869b69611eba..92427ec75f37 100644 --- a/core/java/com/android/internal/jank/InteractionJankMonitor.java +++ b/core/java/com/android/internal/jank/InteractionJankMonitor.java @@ -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"; } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/InteractionJankMonitorWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/InteractionJankMonitorWrapper.java index 4269530f0151..c844db7b770d 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/InteractionJankMonitorWrapper.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/InteractionJankMonitorWrapper.java @@ -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 { diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index e83b7f1a1fce..2ef9e0772d93 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -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 */, @@ -4037,6 +4037,42 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } @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 // resize the layout. Make sure that the window stays small for one frame until the diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt index 05d2bc64c535..3d9fcf9cdecb 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt @@ -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. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt index e6cb68ff17a9..f0fc1432c5a3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt @@ -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) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 20804b13ca57..ef7c7bc0844d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -603,7 +603,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mNotificationStackSizeCalculator, mUnlockedScreenOffAnimationController, mShadeTransitionController, - mInteractionJankMonitor, systemClock, mKeyguardBottomAreaViewModel, mKeyguardBottomAreaInteractor, |