Merge "Add jank monitor trace for divider dragging" into tm-qpr-dev
This commit is contained in:
@@ -18,7 +18,9 @@ package com.android.wm.shell.common;
|
|||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.SurfaceControl;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.internal.jank.InteractionJankMonitor;
|
import com.android.internal.jank.InteractionJankMonitor;
|
||||||
@@ -43,6 +45,24 @@ public class InteractionJankMonitorUtils {
|
|||||||
InteractionJankMonitor.getInstance().begin(builder);
|
InteractionJankMonitor.getInstance().begin(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begin a trace session.
|
||||||
|
*
|
||||||
|
* @param cujType the specific {@link InteractionJankMonitor.CujType}.
|
||||||
|
* @param context the context
|
||||||
|
* @param surface the surface to trace
|
||||||
|
* @param tag the tag to distinguish different flow of same type CUJ.
|
||||||
|
*/
|
||||||
|
public static void beginTracing(@InteractionJankMonitor.CujType int cujType,
|
||||||
|
@NonNull Context context, @NonNull SurfaceControl surface, @Nullable String tag) {
|
||||||
|
final InteractionJankMonitor.Configuration.Builder builder =
|
||||||
|
InteractionJankMonitor.Configuration.Builder.withSurface(cujType, context, surface);
|
||||||
|
if (!TextUtils.isEmpty(tag)) {
|
||||||
|
builder.setTag(tag);
|
||||||
|
}
|
||||||
|
InteractionJankMonitor.getInstance().begin(builder);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End a trace session.
|
* End a trace session.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
|
|||||||
setTouching();
|
setTouching();
|
||||||
mStartPos = touchPos;
|
mStartPos = touchPos;
|
||||||
mMoving = false;
|
mMoving = false;
|
||||||
|
mSplitLayout.onStartDragging();
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
mVelocityTracker.addMovement(event);
|
mVelocityTracker.addMovement(event);
|
||||||
@@ -301,7 +302,10 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
|
|||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
releaseTouching();
|
releaseTouching();
|
||||||
if (!mMoving) break;
|
if (!mMoving) {
|
||||||
|
mSplitLayout.onDraggingCancelled();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
mVelocityTracker.addMovement(event);
|
mVelocityTracker.addMovement(event);
|
||||||
mVelocityTracker.computeCurrentVelocity(1000 /* units */);
|
mVelocityTracker.computeCurrentVelocity(1000 /* units */);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import static android.view.WindowManager.DOCKED_LEFT;
|
|||||||
import static android.view.WindowManager.DOCKED_RIGHT;
|
import static android.view.WindowManager.DOCKED_RIGHT;
|
||||||
import static android.view.WindowManager.DOCKED_TOP;
|
import static android.view.WindowManager.DOCKED_TOP;
|
||||||
|
|
||||||
|
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE;
|
||||||
import static com.android.internal.policy.DividerSnapAlgorithm.SnapTarget.FLAG_DISMISS_END;
|
import static com.android.internal.policy.DividerSnapAlgorithm.SnapTarget.FLAG_DISMISS_END;
|
||||||
import static com.android.internal.policy.DividerSnapAlgorithm.SnapTarget.FLAG_DISMISS_START;
|
import static com.android.internal.policy.DividerSnapAlgorithm.SnapTarget.FLAG_DISMISS_START;
|
||||||
import static com.android.wm.shell.animation.Interpolators.DIM_INTERPOLATOR;
|
import static com.android.wm.shell.animation.Interpolators.DIM_INTERPOLATOR;
|
||||||
@@ -55,7 +56,6 @@ import android.window.WindowContainerTransaction;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.jank.InteractionJankMonitor;
|
|
||||||
import com.android.internal.policy.DividerSnapAlgorithm;
|
import com.android.internal.policy.DividerSnapAlgorithm;
|
||||||
import com.android.internal.policy.DockedDividerUtils;
|
import com.android.internal.policy.DockedDividerUtils;
|
||||||
import com.android.wm.shell.R;
|
import com.android.wm.shell.R;
|
||||||
@@ -407,6 +407,15 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onStartDragging() {
|
||||||
|
InteractionJankMonitorUtils.beginTracing(CUJ_SPLIT_SCREEN_RESIZE, mContext,
|
||||||
|
getDividerLeash(), null /* tag */);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDraggingCancelled() {
|
||||||
|
InteractionJankMonitorUtils.cancelTracing(CUJ_SPLIT_SCREEN_RESIZE);
|
||||||
|
}
|
||||||
|
|
||||||
void onDoubleTappedDivider() {
|
void onDoubleTappedDivider() {
|
||||||
mSplitLayoutHandler.onDoubleTappedDivider();
|
mSplitLayoutHandler.onDoubleTappedDivider();
|
||||||
}
|
}
|
||||||
@@ -438,10 +447,10 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
|
|||||||
if (from == to) {
|
if (from == to) {
|
||||||
// No animation run, still callback to stop resizing.
|
// No animation run, still callback to stop resizing.
|
||||||
mSplitLayoutHandler.onLayoutSizeChanged(this);
|
mSplitLayoutHandler.onLayoutSizeChanged(this);
|
||||||
|
InteractionJankMonitorUtils.endTracing(
|
||||||
|
CUJ_SPLIT_SCREEN_RESIZE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InteractionJankMonitorUtils.beginTracing(InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE,
|
|
||||||
mSplitWindowManager.getDividerView(), "Divider fling");
|
|
||||||
ValueAnimator animator = ValueAnimator
|
ValueAnimator animator = ValueAnimator
|
||||||
.ofInt(from, to)
|
.ofInt(from, to)
|
||||||
.setDuration(250);
|
.setDuration(250);
|
||||||
@@ -455,7 +464,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
|
|||||||
flingFinishedCallback.run();
|
flingFinishedCallback.run();
|
||||||
}
|
}
|
||||||
InteractionJankMonitorUtils.endTracing(
|
InteractionJankMonitorUtils.endTracing(
|
||||||
InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE);
|
CUJ_SPLIT_SCREEN_RESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user