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

Commit 2099dd21 authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Fix pip surface properties during keyguard exit" into udc-dev am: 75faf083

parents d03e1974 75faf083
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -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. */
+12 −0
Original line number Diff line number Diff line
@@ -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() {
    }
+23 −2
Original line number Diff line number Diff line
@@ -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,