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

Commit ea6cf56e authored by Robert Horvath's avatar Robert Horvath
Browse files

Set TvPipController's state only when PiP finished appearing

When asking PipTaskOrganizer to animate the PiP to a different position
while it's still in the appearing transition, the PiP could get stuck in
a bad state where the PiP contents and menu items weren't drawn.
This change avoids this by only calling #scheduleAnimateResizePip once
the PiP has finished appearing.

Test: manual
Bug: 220110011
Change-Id: Ie62adea6f2cb5a4abdd6c4b8f9ff23c040077046
parent 4d897c6a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.wm.shell.common.TaskStackListenerCallback;
import com.android.wm.shell.common.TaskStackListenerImpl;
import com.android.wm.shell.pip.PinnedStackListenerForwarder;
import com.android.wm.shell.pip.Pip;
import com.android.wm.shell.pip.PipAnimationController;
import com.android.wm.shell.pip.PipMediaController;
import com.android.wm.shell.pip.PipTaskOrganizer;
import com.android.wm.shell.pip.PipTransitionController;
@@ -289,7 +290,6 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
        if (DEBUG) Log.d(TAG, "checkIfPinnedTaskAppeared(), task=" + pinnedTask);
        if (pinnedTask == null || pinnedTask.topActivity == null) return;
        mPinnedTaskId = pinnedTask.taskId;
        setState(STATE_PIP);

        mPipMediaController.onActivityPinned();
        mPipNotificationController.show(pinnedTask.topActivity.getPackageName());
@@ -326,6 +326,9 @@ public class TvPipController implements PipTransitionController.PipTransitionCal

    @Override
    public void onPipTransitionFinished(int direction) {
        if (PipAnimationController.isInPipDirection(direction) && mState == STATE_NO_PIP) {
            setState(STATE_PIP);
        }
        if (DEBUG) Log.d(TAG, "onPipTransition_Finished(), state=" + stateToName(mState));
    }