From ea6cf56eccbc45677e8c8736a8333f14f1cfa466 Mon Sep 17 00:00:00 2001 From: Robert Horvath Date: Thu, 17 Feb 2022 14:51:10 +0100 Subject: 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 --- .../Shell/src/com/android/wm/shell/pip/tv/TvPipController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libs/WindowManager/Shell') diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipController.java index 5996acd269d2..50691803e8f9 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipController.java @@ -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)); } -- cgit v1.2.3-59-g8ed1b