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

Commit 5eadb359 authored by Merissa Mitchell's avatar Merissa Mitchell
Browse files

[Pip2] Add a new interface method to IPipAnimationListener

to notify listeners that PiP has exited.

Bug: 416075099
Test: atest WMShellUnitTests:com.android.wm.shell.pip2.phone WMShellUnitTests:com.android.wm.shell.pip
Flag: com.android.wm.shell.enable_pip2

Change-Id: I24be7c58af3379cedfe588d1448b66f473905f60
parent 763ca9da
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -38,4 +38,9 @@ oneway interface IPipAnimationListener {
     * Notifies the listener that user leaves PiP by tapping on the expand button.
     */
    void onExpandPip();

    /**
     * Notifies the listener that the PiP has exited.
     */
    void onExitPip();
}
+10 −0
Original line number Diff line number Diff line
@@ -238,6 +238,11 @@ public class PipController implements PipTransitionController.PipTransitionCallb
         * Notifies the listener that user leaves PiP by tapping on the expand button.
         */
        void onExpandPip();

        /**
         * Notifies the listener that the PiP has exited.
         */
        void onExitPip();
    }

    /**
@@ -1305,6 +1310,11 @@ public class PipController implements PipTransitionController.PipTransitionCallb
            public void onExpandPip() {
                mListener.call(l -> l.onExpandPip());
            }

            @Override
            public void onExitPip() {
                mListener.call(l -> l.onExitPip());
            }
        };

        IPipImpl(PipController controller) {
+13 −0
Original line number Diff line number Diff line
@@ -150,6 +150,11 @@ public class PipController implements ConfigurationChangeListener,
         * Notifies the listener that user leaves PiP by tapping on the expand button.
         */
        void onExpandPip();

        /**
         * Notifies the listener that the PiP has exited.
         */
        void onExitPip();
    }

    private PipController(Context context,
@@ -621,6 +626,9 @@ public class PipController implements ConfigurationChangeListener,
                for (Consumer<Boolean> listener : mOnIsInPipStateChangedListeners) {
                    listener.accept(false /* inPip */);
                }
                if (mPipRecentsAnimationListener != null) {
                    mPipRecentsAnimationListener.onExitPip();
                }
                break;
            case PipTransitionState.SCHEDULED_BOUNDS_CHANGE:
                mWaitingToPlayDisplayChangeBoundsUpdate =
@@ -773,6 +781,11 @@ public class PipController implements ConfigurationChangeListener,
            public void onExpandPip() {
                mListener.call(l -> l.onExpandPip());
            }

            @Override
            public void onExitPip() {
                mListener.call(l -> l.onExitPip());
            }
        };

        IPipImpl(PipController controller) {
+2 −0
Original line number Diff line number Diff line
@@ -207,6 +207,8 @@ public class PipControllerTest extends ShellTestCase {
            public void onPipResourceDimensionsChanged(int cornerRadius, int shadowRadius) {}
            @Override
            public void onExpandPip() {}
            @Override
            public void onExitPip() {}
        });
        assertTrue(mPipController.hasPinnedStackAnimationListener());
        // Create initial interface