Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e04c323 authored by Ikram Gabiyev's avatar Ikram Gabiyev Committed by Android (Google) Code Review
Browse files

Merge "[PiP2] Add Enter PiP jank cuj tag" into main

parents 674266fe 610a6f2a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ import java.lang.annotation.RetentionPolicy;
public class PipInteractionHandler {
    @IntDef(prefix = {"INTERACTION_"}, value = {
            INTERACTION_EXIT_PIP,
            INTERACTION_EXIT_PIP_TO_SPLIT
            INTERACTION_EXIT_PIP_TO_SPLIT,
            INTERACTION_ENTER_PIP
    })

    @Retention(RetentionPolicy.SOURCE)
@@ -42,6 +43,7 @@ public class PipInteractionHandler {

    public static final int INTERACTION_EXIT_PIP = 0;
    public static final int INTERACTION_EXIT_PIP_TO_SPLIT = 1;
    public static final int INTERACTION_ENTER_PIP = 2;

    private final Context mContext;
    private final Handler mHandler;
@@ -82,6 +84,7 @@ public class PipInteractionHandler {
        return switch (interaction) {
            case INTERACTION_EXIT_PIP -> "EXIT_PIP";
            case INTERACTION_EXIT_PIP_TO_SPLIT -> "EXIT_PIP_TO_SPLIT";
            case INTERACTION_ENTER_PIP -> "ENTER_PIP";
            default -> "";
        };
    }
+5 −0
Original line number Diff line number Diff line
@@ -1178,6 +1178,11 @@ public class PipTransition extends PipTransitionController implements

                Preconditions.checkState(hasValidTokenAndLeash,
                        "Unexpected bundle for " + mPipTransitionState);
                mPipInteractionHandler.begin(mPipTransitionState.getPinnedTaskLeash(),
                        PipInteractionHandler.INTERACTION_ENTER_PIP);
                break;
            case PipTransitionState.ENTERED_PIP:
                mPipInteractionHandler.end();
                break;
            case PipTransitionState.EXITED_PIP:
                mPipTransitionState.setPinnedTaskLeash(null);
+10 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.pip2.phone;

import static com.android.internal.jank.Cuj.CUJ_PIP_TRANSITION;
import static com.android.wm.shell.pip2.phone.PipInteractionHandler.INTERACTION_ENTER_PIP;
import static com.android.wm.shell.pip2.phone.PipInteractionHandler.INTERACTION_EXIT_PIP;
import static com.android.wm.shell.pip2.phone.PipInteractionHandler.INTERACTION_EXIT_PIP_TO_SPLIT;

@@ -86,6 +87,15 @@ public class PipInteractionHandlerTest {
                eq(PipInteractionHandler.pipInteractionToString(INTERACTION_EXIT_PIP_TO_SPLIT)));
    }

    @Test
    public void begin_enter_startsTracking() {
        mPipInteractionHandler.begin(mTestLeash, INTERACTION_ENTER_PIP);

        verify(mMockInteractionJankMonitor, times(1)).begin(eq(mTestLeash),
                eq(mMockContext), eq(mMockHandler), eq(CUJ_PIP_TRANSITION),
                eq(PipInteractionHandler.pipInteractionToString(INTERACTION_ENTER_PIP)));
    }

    @Test
    public void end_stopsTracking() {
        mPipInteractionHandler.end();