diff options
3 files changed, 41 insertions, 18 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java index d77619a396d7..1d238a116059 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java @@ -137,11 +137,6 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, public void onPipAnimationStart(TaskInfo taskInfo, PipAnimationController.PipTransitionAnimator animator) { final int direction = animator.getTransitionDirection(); - if (direction == TRANSITION_DIRECTION_TO_PIP) { - // TODO (b//169221267): Add jank listener for transactions without buffer updates. - //InteractionJankMonitor.getInstance().begin( - // InteractionJankMonitor.CUJ_LAUNCHER_APP_CLOSE_TO_PIP, 2000); - } sendOnPipTransitionStarted(direction); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java index dedc56678ef1..dbf603ca72d9 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java @@ -19,7 +19,6 @@ package com.android.wm.shell.pip; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_REMOVE_STACK; -import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_TO_PIP; import android.app.PictureInPictureParams; import android.app.TaskInfo; @@ -57,12 +56,6 @@ public abstract class PipTransitionController implements Transitions.TransitionH public void onPipAnimationStart(TaskInfo taskInfo, PipAnimationController.PipTransitionAnimator animator) { final int direction = animator.getTransitionDirection(); - if (direction == TRANSITION_DIRECTION_TO_PIP) { - // TODO (b//169221267): Add jank listener for transactions without buffer - // updates. - //InteractionJankMonitor.getInstance().begin( - // InteractionJankMonitor.CUJ_LAUNCHER_APP_CLOSE_TO_PIP, 2000); - } sendOnPipTransitionStarted(direction); } @@ -76,12 +69,6 @@ public abstract class PipTransitionController implements Transitions.TransitionH } onFinishResize(taskInfo, animator.getDestinationBounds(), direction, tx); sendOnPipTransitionFinished(direction); - if (direction == TRANSITION_DIRECTION_TO_PIP) { - // TODO (b//169221267): Add jank listener for transactions without buffer - // updates. - //InteractionJankMonitor.getInstance().end( - // InteractionJankMonitor.CUJ_LAUNCHER_APP_CLOSE_TO_PIP); - } } @Override diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java index 62b50c55e77c..92c0099c6557 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java @@ -21,7 +21,15 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE; import static android.view.WindowManager.INPUT_CONSUMER_PIP; +import static com.android.internal.jank.InteractionJankMonitor.CUJ_PIP_TRANSITION; import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission; +import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_EXPAND_OR_UNEXPAND; +import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP; +import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN; +import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_REMOVE_STACK; +import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_SNAP_AFTER_RESIZE; +import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_TO_PIP; +import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_USER_RESIZE; import static com.android.wm.shell.pip.PipAnimationController.isOutPipDirection; import android.app.ActivityManager; @@ -52,6 +60,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.jank.InteractionJankMonitor; import com.android.wm.shell.R; import com.android.wm.shell.WindowManagerShellWrapper; import com.android.wm.shell.common.DisplayChangeController; @@ -567,8 +576,37 @@ public class PipController implements PipTransitionController.PipTransitionCallb mPipTaskOrganizer.stopSwipePipToHome(componentName, destinationBounds, overlay); } + private String getTransitionTag(int direction) { + switch (direction) { + case TRANSITION_DIRECTION_TO_PIP: + return "TRANSITION_TO_PIP"; + case TRANSITION_DIRECTION_LEAVE_PIP: + return "TRANSITION_LEAVE_PIP"; + case TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN: + return "TRANSITION_LEAVE_PIP_TO_SPLIT_SCREEN"; + case TRANSITION_DIRECTION_REMOVE_STACK: + return "TRANSITION_REMOVE_STACK"; + case TRANSITION_DIRECTION_SNAP_AFTER_RESIZE: + return "TRANSITION_SNAP_AFTER_RESIZE"; + case TRANSITION_DIRECTION_USER_RESIZE: + return "TRANSITION_USER_RESIZE"; + case TRANSITION_DIRECTION_EXPAND_OR_UNEXPAND: + return "TRANSITION_EXPAND_OR_UNEXPAND"; + default: + return "TRANSITION_LEAVE_UNKNOWN"; + } + } + @Override public void onPipTransitionStarted(int direction, Rect pipBounds) { + // Begin InteractionJankMonitor with PIP transition CUJs + final InteractionJankMonitor.Configuration.Builder builder = + InteractionJankMonitor.Configuration.Builder.withSurface( + CUJ_PIP_TRANSITION, mContext, mPipTaskOrganizer.getSurfaceControl()) + .setTag(getTransitionTag(direction)) + .setTimeout(2000); + InteractionJankMonitor.getInstance().begin(builder); + if (isOutPipDirection(direction)) { // Exiting PIP, save the reentry state to restore to when re-entering. saveReentryState(pipBounds); @@ -607,6 +645,9 @@ public class PipController implements PipTransitionController.PipTransitionCallb } private void onPipTransitionFinishedOrCanceled(int direction) { + // End InteractionJankMonitor with PIP transition by CUJs + InteractionJankMonitor.getInstance().end(CUJ_PIP_TRANSITION); + // Re-enable touches after the animation completes mTouchHandler.setTouchEnabled(true); mTouchHandler.onPinnedStackAnimationEnded(direction); |