PiP: Show the wallpaper as part of the transition.

This is usually taken care by RemoteAnimation, but since PiP takes
control of the entire thing that is no longer the case. So let's just
handle it.

Bug: 165793917
Test: Enter PiP with ENABLE_SHELL_TRANSITIONS flag on
Change-Id: I8f0af4472c20016f856f33f903bd9a431cd5ef3a
This commit is contained in:
Ben Lin
2021-05-20 16:35:12 -07:00
parent 51d1d7c1d9
commit d9e72a7b34

View File

@@ -18,6 +18,7 @@ package com.android.wm.shell.pip;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
import static com.android.wm.shell.pip.PipAnimationController.ANIM_TYPE_ALPHA;
import static com.android.wm.shell.pip.PipAnimationController.ANIM_TYPE_BOUNDS;
@@ -90,17 +91,32 @@ public class PipTransition extends PipTransitionController {
return success;
}
// Search for an Enter PiP transition (along with a show wallpaper one)
TransitionInfo.Change enterPip = null;
TransitionInfo.Change wallpaper = null;
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
final TransitionInfo.Change change = info.getChanges().get(i);
if (change.getTaskInfo() != null
&& change.getTaskInfo().configuration.windowConfiguration.getWindowingMode()
== WINDOWING_MODE_PINNED) {
mFinishCallback = finishCallback;
return startEnterAnimation(change.getTaskInfo(), change.getLeash(),
startTransaction, finishTransaction);
enterPip = change;
} else if ((change.getFlags() & FLAG_IS_WALLPAPER) != 0) {
wallpaper = change;
}
}
return false;
if (enterPip == null) {
return false;
}
// Show the wallpaper if there is a wallpaper change.
if (wallpaper != null) {
startTransaction.show(wallpaper.getLeash());
startTransaction.setAlpha(wallpaper.getLeash(), 1.f);
}
mFinishCallback = finishCallback;
return startEnterAnimation(enterPip.getTaskInfo(), enterPip.getLeash(),
startTransaction, finishTransaction);
}
@Nullable
@@ -160,7 +176,6 @@ public class PipTransition extends PipTransitionController {
0 /* startingAngle */, Surface.ROTATION_0);
} else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) {
startTransaction.setAlpha(leash, 0f);
startTransaction.apply();
animator = mPipAnimationController.getAnimator(taskInfo, leash, destinationBounds,
0f, 1f);
mOneShotAnimationType = ANIM_TYPE_BOUNDS;
@@ -168,6 +183,7 @@ public class PipTransition extends PipTransitionController {
throw new RuntimeException("Unrecognized animation type: "
+ mOneShotAnimationType);
}
startTransaction.apply();
animator.setTransitionDirection(TRANSITION_DIRECTION_TO_PIP)
.setPipAnimationCallback(mPipAnimationCallback)
.setDuration(mEnterExitAnimationDuration)