From 78c41067a1cac88f18aadcb47ff19639098d9572 Mon Sep 17 00:00:00 2001 From: Ikram Gabiyev Date: Mon, 30 Sep 2024 14:08:02 -0700 Subject: Opening type changes need alpha=1 when PiPing In general, recents transitions opening tasks or bringing them TO_FRONT have alpha=0 set in Transitions#setupStartState(). So when we are entering PiP as a part of TRANSIT_OPEN, for example, we need to reset the alpha of to_front/open mode changes to 1f. Bug: 359922654 Flag: com.android.wm.shell.enable_pip2 Test: tap home in 3-btn-nav from PiP-able activity Change-Id: Id7cd8d65056e68a639b4ab38b0d2e55995bc72d5 --- .../src/com/android/wm/shell/pip2/phone/PipTransition.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java index f93233ec7461..1b9bf2acbb96 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java @@ -54,6 +54,7 @@ import com.android.wm.shell.common.pip.PipUtils; import com.android.wm.shell.pip.PipTransitionController; import com.android.wm.shell.pip2.animation.PipAlphaAnimator; import com.android.wm.shell.pip2.animation.PipEnterExitAnimator; +import com.android.wm.shell.shared.TransitionUtil; import com.android.wm.shell.shared.pip.PipContentOverlay; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.transition.Transitions; @@ -405,6 +406,18 @@ public class PipTransition extends PipTransitionController implements sourceRectHint = pipChange.getTaskInfo().pictureInPictureParams.getSourceRectHint(); } + // For opening type transitions, if there is a non-pip change of mode TO_FRONT/OPEN, + // make sure that change has alpha of 1f, since it's init state might be set to alpha=0f + // by the Transitions framework to simplify Task opening transitions. + if (TransitionUtil.isOpeningType(info.getType())) { + for (TransitionInfo.Change change : info.getChanges()) { + if (change.getLeash() == null || change == pipChange) continue; + if (change.getMode() == TRANSIT_OPEN || change.getMode() == TRANSIT_TO_FRONT) { + startTransaction.setAlpha(change.getLeash(), 1f); + } + } + } + PipEnterExitAnimator animator = new PipEnterExitAnimator(mContext, pipLeash, startTransaction, finishTransaction, startBounds, startBounds, endBounds, sourceRectHint, PipEnterExitAnimator.BOUNDS_ENTER, Surface.ROTATION_0); -- cgit v1.2.3-59-g8ed1b