Merge "Refine the latency and jank instrumentation of opening panel" into sc-dev

This commit is contained in:
Wu Ahan
2021-05-04 08:14:43 +00:00
committed by Android (Google) Code Review
3 changed files with 17 additions and 8 deletions

View File

@@ -213,7 +213,9 @@ public class OverviewProxyService extends CurrentUserTracker implements
// TODO move this logic to message queue // TODO move this logic to message queue
mStatusBarOptionalLazy.ifPresent(statusBarLazy -> { mStatusBarOptionalLazy.ifPresent(statusBarLazy -> {
StatusBar statusBar = statusBarLazy.get(); StatusBar statusBar = statusBarLazy.get();
statusBar.getPanelController().startExpandLatencyTracking(); if (event.getActionMasked() == ACTION_DOWN) {
statusBar.getPanelController().startExpandLatencyTracking();
}
mHandler.post(()-> { mHandler.post(()-> {
int action = event.getActionMasked(); int action = event.getActionMasked();
if (action == ACTION_DOWN) { if (action == ACTION_DOWN) {

View File

@@ -22,7 +22,6 @@ import static androidx.constraintlayout.widget.ConstraintSet.END;
import static androidx.constraintlayout.widget.ConstraintSet.PARENT_ID; import static androidx.constraintlayout.widget.ConstraintSet.PARENT_ID;
import static androidx.constraintlayout.widget.ConstraintSet.START; import static androidx.constraintlayout.widget.ConstraintSet.START;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE; import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE;
import static com.android.systemui.classifier.Classifier.QS_COLLAPSE; import static com.android.systemui.classifier.Classifier.QS_COLLAPSE;
import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS; import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
@@ -1730,7 +1729,6 @@ public class NotificationPanelViewController extends PanelViewController {
return; return;
} }
mExpectingSynthesizedDown = true; mExpectingSynthesizedDown = true;
InteractionJankMonitor.getInstance().begin(mView, CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE);
onTrackingStarted(); onTrackingStarted();
updatePanelExpanded(); updatePanelExpanded();
} }

View File

@@ -637,6 +637,12 @@ public abstract class PanelViewController {
animator.addListener(new AnimatorListenerAdapter() { animator.addListener(new AnimatorListenerAdapter() {
private boolean mCancelled; private boolean mCancelled;
@Override
public void onAnimationStart(Animator animation) {
InteractionJankMonitor.getInstance()
.begin(mView, CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE);
}
@Override @Override
public void onAnimationCancel(Animator animation) { public void onAnimationCancel(Animator animation) {
mCancelled = true; mCancelled = true;
@@ -1412,11 +1418,14 @@ public abstract class PanelViewController {
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
addMovement(event); addMovement(event);
endMotionEvent(event, x, y, false /* forceCancel */); endMotionEvent(event, x, y, false /* forceCancel */);
InteractionJankMonitor monitor = InteractionJankMonitor.getInstance(); // mHeightAnimator is null, there is no remaining frame, ends instrumenting.
if (event.getActionMasked() == MotionEvent.ACTION_UP) { if (mHeightAnimator == null) {
monitor.end(CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE); InteractionJankMonitor monitor = InteractionJankMonitor.getInstance();
} else { if (event.getActionMasked() == MotionEvent.ACTION_UP) {
monitor.cancel(CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE); monitor.end(CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE);
} else {
monitor.cancel(CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE);
}
} }
break; break;
} }