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

Commit 86571395 authored by Jacqueline Bronger's avatar Jacqueline Bronger
Browse files

Fix TV PiP back and forth animation after switch

When switching from one PiP to another, the new PiP was briefly starting
to animate to the size of the previous PiP before going back to the new
size.

Bug: 264362433
Test: manual - launch a vertical PiP and then start a horizontal PiP on
top of it (orientation change only to make issue more visible if it
happens)

Change-Id: Ic954444756b245cfd44c1f2b97ada668fc6ace83
parent 3ad4f200
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -125,7 +125,9 @@ public class TvPipBoundsController {
            cancelScheduledPlacement();
            applyPlacement(placement, shouldStash, animationDuration);
        } else {
            if (mCurrentPlacementBounds != null) {
                applyPlacementBounds(mCurrentPlacementBounds, animationDuration);
            }
            schedulePinnedStackPlacement(placement, animationDuration);
        }
    }
@@ -188,7 +190,7 @@ public class TvPipBoundsController {
        applyPlacementBounds(bounds, animationDuration);
    }

    void onPipDismissed() {
    void reset() {
        mCurrentPlacementBounds = null;
        mPipTargetBounds = null;
        cancelScheduledPlacement();
+11 −14
Original line number Diff line number Diff line
@@ -450,18 +450,6 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
        mPipMediaController.registerSessionListenerForCurrentUser();
    }

    private void checkIfPinnedTaskAppeared() {
        final TaskInfo pinnedTask = getPinnedTaskInfo();
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "%s: checkIfPinnedTaskAppeared(), task=%s", TAG, pinnedTask);
        if (pinnedTask == null || pinnedTask.topActivity == null) return;
        mPinnedTaskId = pinnedTask.taskId;

        mPipMediaController.onActivityPinned();
        mActionBroadcastReceiver.register();
        mPipNotificationController.show(pinnedTask.topActivity.getPackageName());
    }

    private void checkIfPinnedTaskIsGone() {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "%s: onTaskStackChanged()", TAG);
@@ -482,7 +470,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal

        mTvPipMenuController.closeMenu();
        mTvPipBoundsState.resetTvPipState();
        mTvPipBoundsController.onPipDismissed();
        mTvPipBoundsController.reset();
        setState(STATE_NO_PIP);
        mPinnedTaskId = NONEXISTENT_TASK_ID;
    }
@@ -537,7 +525,16 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
        taskStackListener.addListener(new TaskStackListenerCallback() {
            @Override
            public void onActivityPinned(String packageName, int userId, int taskId, int stackId) {
                checkIfPinnedTaskAppeared();
                final TaskInfo pinnedTask = getPinnedTaskInfo();
                ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                        "%s: onActivityPinned(), task=%s", TAG, pinnedTask);
                if (pinnedTask == null || pinnedTask.topActivity == null) return;
                mPinnedTaskId = pinnedTask.taskId;

                mPipMediaController.onActivityPinned();
                mActionBroadcastReceiver.register();
                mPipNotificationController.show(pinnedTask.topActivity.getPackageName());
                mTvPipBoundsController.reset();
                mAppOpsListener.onActivityPinned(packageName);
            }