Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/InteractionJankMonitorUtils.java +20 −0 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.wm.shell.common; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.text.TextUtils; import android.view.SurfaceControl; import android.view.View; import com.android.internal.jank.InteractionJankMonitor; Loading @@ -43,6 +45,24 @@ public class InteractionJankMonitorUtils { 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. * Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java +5 −1 Original line number Diff line number Diff line Loading @@ -286,6 +286,7 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { setTouching(); mStartPos = touchPos; mMoving = false; mSplitLayout.onStartDragging(); break; case MotionEvent.ACTION_MOVE: mVelocityTracker.addMovement(event); Loading @@ -301,7 +302,10 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: releaseTouching(); if (!mMoving) break; if (!mMoving) { mSplitLayout.onDraggingCancelled(); break; } mVelocityTracker.addMovement(event); mVelocityTracker.computeCurrentVelocity(1000 /* units */); Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +13 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.view.WindowManager.DOCKED_LEFT; import static android.view.WindowManager.DOCKED_RIGHT; 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_START; import static com.android.wm.shell.animation.Interpolators.DIM_INTERPOLATOR; Loading Loading @@ -55,7 +56,6 @@ import android.window.WindowContainerTransaction; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.policy.DividerSnapAlgorithm; import com.android.internal.policy.DockedDividerUtils; import com.android.wm.shell.R; Loading Loading @@ -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() { mSplitLayoutHandler.onDoubleTappedDivider(); } Loading Loading @@ -438,10 +447,10 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange if (from == to) { // No animation run, still callback to stop resizing. mSplitLayoutHandler.onLayoutSizeChanged(this); InteractionJankMonitorUtils.endTracing( CUJ_SPLIT_SCREEN_RESIZE); return; } InteractionJankMonitorUtils.beginTracing(InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE, mSplitWindowManager.getDividerView(), "Divider fling"); ValueAnimator animator = ValueAnimator .ofInt(from, to) .setDuration(250); Loading @@ -455,7 +464,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange flingFinishedCallback.run(); } InteractionJankMonitorUtils.endTracing( InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE); CUJ_SPLIT_SCREEN_RESIZE); } @Override Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/InteractionJankMonitorUtils.java +20 −0 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.wm.shell.common; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.text.TextUtils; import android.view.SurfaceControl; import android.view.View; import com.android.internal.jank.InteractionJankMonitor; Loading @@ -43,6 +45,24 @@ public class InteractionJankMonitorUtils { 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. * Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java +5 −1 Original line number Diff line number Diff line Loading @@ -286,6 +286,7 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { setTouching(); mStartPos = touchPos; mMoving = false; mSplitLayout.onStartDragging(); break; case MotionEvent.ACTION_MOVE: mVelocityTracker.addMovement(event); Loading @@ -301,7 +302,10 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: releaseTouching(); if (!mMoving) break; if (!mMoving) { mSplitLayout.onDraggingCancelled(); break; } mVelocityTracker.addMovement(event); mVelocityTracker.computeCurrentVelocity(1000 /* units */); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +13 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.view.WindowManager.DOCKED_LEFT; import static android.view.WindowManager.DOCKED_RIGHT; 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_START; import static com.android.wm.shell.animation.Interpolators.DIM_INTERPOLATOR; Loading Loading @@ -55,7 +56,6 @@ import android.window.WindowContainerTransaction; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.policy.DividerSnapAlgorithm; import com.android.internal.policy.DockedDividerUtils; import com.android.wm.shell.R; Loading Loading @@ -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() { mSplitLayoutHandler.onDoubleTappedDivider(); } Loading Loading @@ -438,10 +447,10 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange if (from == to) { // No animation run, still callback to stop resizing. mSplitLayoutHandler.onLayoutSizeChanged(this); InteractionJankMonitorUtils.endTracing( CUJ_SPLIT_SCREEN_RESIZE); return; } InteractionJankMonitorUtils.beginTracing(InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE, mSplitWindowManager.getDividerView(), "Divider fling"); ValueAnimator animator = ValueAnimator .ofInt(from, to) .setDuration(250); Loading @@ -455,7 +464,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange flingFinishedCallback.run(); } InteractionJankMonitorUtils.endTracing( InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE); CUJ_SPLIT_SCREEN_RESIZE); } @Override Loading