diff options
3 files changed, 49 insertions, 4 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java index 9677728d1d18..fa21db5f22ee 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java @@ -1015,6 +1015,16 @@ public class PipTransition extends PipTransitionController { mPipOrganizer.onExitPipFinished(prevPipTaskChange.getTaskInfo()); } + @Override + public boolean syncPipSurfaceState(@NonNull TransitionInfo info, + @NonNull SurfaceControl.Transaction startTransaction, + @NonNull SurfaceControl.Transaction finishTransaction) { + final TransitionInfo.Change pipChange = findCurrentPipTaskChange(info); + if (pipChange == null) return false; + updatePipForUnhandledTransition(pipChange, startTransaction, finishTransaction); + return true; + } + private void updatePipForUnhandledTransition(@NonNull TransitionInfo.Change pipChange, @NonNull SurfaceControl.Transaction startTransaction, @NonNull SurfaceControl.Transaction finishTransaction) { @@ -1025,10 +1035,12 @@ public class PipTransition extends PipTransitionController { final boolean isInPip = mPipTransitionState.isInPip(); mSurfaceTransactionHelper .crop(startTransaction, leash, destBounds) - .round(startTransaction, leash, isInPip); + .round(startTransaction, leash, isInPip) + .shadow(startTransaction, leash, isInPip); mSurfaceTransactionHelper .crop(finishTransaction, leash, destBounds) - .round(finishTransaction, leash, isInPip); + .round(finishTransaction, leash, isInPip) + .shadow(finishTransaction, leash, isInPip); } /** Hides and shows the existing PIP during fixed rotation transition of other activities. */ diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java index 949d6f558c32..2fff0e469f3d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java @@ -240,6 +240,18 @@ public abstract class PipTransitionController implements Transitions.TransitionH @NonNull final Transitions.TransitionFinishCallback finishCallback) { } + /** + * Applies the proper surface states (rounded corners/shadows) to pip surfaces in `info`. + * This is intended to be used when PiP is part of another animation but isn't, itself, + * animating (eg. unlocking). + * @return `true` if there was a pip in `info`. + */ + public boolean syncPipSurfaceState(@NonNull TransitionInfo info, + @NonNull SurfaceControl.Transaction startTransaction, + @NonNull SurfaceControl.Transaction finishTransaction) { + return false; + } + /** End the currently-playing PiP animation. */ public void end() { } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java index 42633b722649..863b5ab73a7d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java @@ -304,8 +304,8 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler, return animateRecentsDuringSplit(mixed, info, startTransaction, finishTransaction, finishCallback); } else if (mixed.mType == MixedTransition.TYPE_KEYGUARD) { - return mKeyguardHandler.startAnimation( - transition, info, startTransaction, finishTransaction, finishCallback); + return animateKeyguard(mixed, info, startTransaction, finishTransaction, + finishCallback); } else { mActiveTransitions.remove(mixed); throw new IllegalStateException("Starting mixed animation without a known mixed type? " @@ -557,6 +557,27 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler, return handled; } + private boolean animateKeyguard(@NonNull final MixedTransition mixed, + @NonNull TransitionInfo info, + @NonNull SurfaceControl.Transaction startTransaction, + @NonNull SurfaceControl.Transaction finishTransaction, + @NonNull Transitions.TransitionFinishCallback finishCallback) { + boolean consumed = mKeyguardHandler.startAnimation( + mixed.mTransition, info, startTransaction, finishTransaction, finishCallback); + if (!consumed) { + return false; + } + // Sync pip state. + if (mPipHandler != null) { + // We don't know when to apply `startTransaction` so use a separate transaction here. + // This should be fine because these surface properties are independent. + final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); + mPipHandler.syncPipSurfaceState(info, t, finishTransaction); + t.apply(); + } + return true; + } + @Override public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget, |