diff options
| author | 2021-11-12 07:06:23 +0000 | |
|---|---|---|
| committer | 2021-11-12 07:06:23 +0000 | |
| commit | f322e418ced0a08294c0a5ecbe9a85d1a1599ff4 (patch) | |
| tree | 924ff8d9c141293e99c3d1f445bd886fb3fe8f33 | |
| parent | 3e6e8030f101a093423d6dfa010204b2bbcd693d (diff) | |
| parent | 99c2727ebe23973be6daab151726ef221c2ccce7 (diff) | |
Merge "Add CUJ_NOTIFICATION_SHADE_ROW_SWIPE CUJ"
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/SwipeHelper.java | 14 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java | 24 |
2 files changed, 38 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 3555e8d8e193..4a0c30ccd798 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -372,6 +372,11 @@ public class SwipeHelper implements Gefingerpoken { } /** + * After dismissChild() and related animation finished, this function will be called. + */ + protected void onDismissChildWithAnimationFinished() {} + + /** * @param view The view to be dismissed * @param velocity The desired pixels/second speed at which the view should move * @param useAccelerateInterpolator Should an accelerating Interpolator be used @@ -436,6 +441,7 @@ public class SwipeHelper implements Gefingerpoken { Animator anim = getViewTranslationAnimator(animView, newPos, updateListener); if (anim == null) { + onDismissChildWithAnimationFinished(); return; } if (useAccelerateInterpolator) { @@ -481,6 +487,7 @@ public class SwipeHelper implements Gefingerpoken { if (!mDisableHwLayers) { animView.setLayerType(View.LAYER_TYPE_NONE, null); } + onDismissChildWithAnimationFinished(); } }); @@ -505,6 +512,11 @@ public class SwipeHelper implements Gefingerpoken { // Do nothing } + /** + * After snapChild() and related animation finished, this function will be called. + */ + protected void onSnapChildWithAnimationFinished() {} + public void snapChild(final View animView, final float targetLeft, float velocity) { final boolean canBeDismissed = mCallback.canChildBeDismissed(animView); AnimatorUpdateListener updateListener = animation -> onTranslationUpdate(animView, @@ -512,6 +524,7 @@ public class SwipeHelper implements Gefingerpoken { Animator anim = getViewTranslationAnimator(animView, targetLeft, updateListener); if (anim == null) { + onSnapChildWithAnimationFinished(); return; } anim.addListener(new AnimatorListenerAdapter() { @@ -529,6 +542,7 @@ public class SwipeHelper implements Gefingerpoken { updateSwipeProgressFromOffset(animView, canBeDismissed); resetSwipeState(); } + onSnapChildWithAnimationFinished(); } }); prepareSnapBackAnimation(animView, anim); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java index 664776975b24..eb7410c08733 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java @@ -17,6 +17,8 @@ package com.android.systemui.statusbar.notification.stack; +import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_ROW_SWIPE; + import android.animation.Animator; import android.animation.ValueAnimator; import android.content.res.Resources; @@ -28,6 +30,7 @@ import android.view.View; import android.view.ViewConfiguration; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.jank.InteractionJankMonitor; import com.android.systemui.SwipeHelper; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.FalsingManager; @@ -264,6 +267,22 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc } @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + final boolean previousIsSwiping = isSwiping(); + boolean ret = super.onInterceptTouchEvent(ev); + final View swipedView = getSwipedView(); + if (!previousIsSwiping && swipedView != null) { + InteractionJankMonitor.getInstance().begin(swipedView, + CUJ_NOTIFICATION_SHADE_ROW_SWIPE); + } + return ret; + } + + protected void onDismissChildWithAnimationFinished() { + InteractionJankMonitor.getInstance().end(CUJ_NOTIFICATION_SHADE_ROW_SWIPE); + } + + @Override public void dismissChild(final View view, float velocity, boolean useAccelerateInterpolator) { superDismissChild(view, velocity, useAccelerateInterpolator); @@ -281,6 +300,11 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc super.dismissChild(view, velocity, useAccelerateInterpolator); } + @Override + protected void onSnapChildWithAnimationFinished() { + InteractionJankMonitor.getInstance().end(CUJ_NOTIFICATION_SHADE_ROW_SWIPE); + } + @VisibleForTesting protected void superSnapChild(final View animView, final float targetLeft, float velocity) { super.snapChild(animView, targetLeft, velocity); |