Add CUJ_NOTIFICATION_SHADE_ROW_SWIPE CUJ
Add CUJ_NOTIFICATION_SHADE_ROW_SWIPE for recording during a notification is being swiped by user. Bug: 199715431 Test: atest com.android.systemui.statusbar.notification.stack.NotificationSwipeHelperTest Change-Id: I5f4f751766906d87c91ff81cba22094deba3caf3
This commit is contained in:
@@ -371,6 +371,11 @@ public class SwipeHelper implements Gefingerpoken {
|
||||
return mIsSwiping || mLongPressSent || mMenuRowIntercepting;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -263,6 +266,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) {
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user