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

Commit 75faf083 authored by Evan Rosky's avatar Evan Rosky Committed by Android (Google) Code Review
Browse files

Merge "Fix pip surface properties during keyguard exit" into udc-dev

parents 3238a42f fe71747d
Loading
Loading
Loading
Loading
+14 −2
Original line number Original line Diff line number Diff line
@@ -1015,6 +1015,16 @@ public class PipTransition extends PipTransitionController {
        mPipOrganizer.onExitPipFinished(prevPipTaskChange.getTaskInfo());
        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,
    private void updatePipForUnhandledTransition(@NonNull TransitionInfo.Change pipChange,
            @NonNull SurfaceControl.Transaction startTransaction,
            @NonNull SurfaceControl.Transaction startTransaction,
            @NonNull SurfaceControl.Transaction finishTransaction) {
            @NonNull SurfaceControl.Transaction finishTransaction) {
@@ -1025,10 +1035,12 @@ public class PipTransition extends PipTransitionController {
        final boolean isInPip = mPipTransitionState.isInPip();
        final boolean isInPip = mPipTransitionState.isInPip();
        mSurfaceTransactionHelper
        mSurfaceTransactionHelper
                .crop(startTransaction, leash, destBounds)
                .crop(startTransaction, leash, destBounds)
                .round(startTransaction, leash, isInPip);
                .round(startTransaction, leash, isInPip)
                .shadow(startTransaction, leash, isInPip);
        mSurfaceTransactionHelper
        mSurfaceTransactionHelper
                .crop(finishTransaction, leash, destBounds)
                .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. */
    /** Hides and shows the existing PIP during fixed rotation transition of other activities. */
+12 −0
Original line number Original line Diff line number Diff line
@@ -240,6 +240,18 @@ public abstract class PipTransitionController implements Transitions.TransitionH
            @NonNull final Transitions.TransitionFinishCallback finishCallback) {
            @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. */
    /** End the currently-playing PiP animation. */
    public void end() {
    public void end() {
    }
    }
+23 −2
Original line number Original line Diff line number Diff line
@@ -304,8 +304,8 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
            return animateRecentsDuringSplit(mixed, info, startTransaction, finishTransaction,
            return animateRecentsDuringSplit(mixed, info, startTransaction, finishTransaction,
                    finishCallback);
                    finishCallback);
        } else if (mixed.mType == MixedTransition.TYPE_KEYGUARD) {
        } else if (mixed.mType == MixedTransition.TYPE_KEYGUARD) {
            return mKeyguardHandler.startAnimation(
            return animateKeyguard(mixed, info, startTransaction, finishTransaction,
                    transition, info, startTransaction, finishTransaction, finishCallback);
                    finishCallback);
        } else {
        } else {
            mActiveTransitions.remove(mixed);
            mActiveTransitions.remove(mixed);
            throw new IllegalStateException("Starting mixed animation without a known mixed type? "
            throw new IllegalStateException("Starting mixed animation without a known mixed type? "
@@ -557,6 +557,27 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
        return handled;
        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
    @Override
    public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
    public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
            @NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget,
            @NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget,