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

Commit c5df5902 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensure that starting surface transaction is applied correctly" into main

parents 6c97f898 b9fa8013
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -454,6 +454,7 @@ public class OriginRemoteTransition extends IRemoteTransition.Stub implements
    private static void applyWindowAnimationStates(
            TransitionInfo info,
            @Nullable WindowAnimationState[] states,
            UIComponent.Transaction transactions,
            UIComponent closingApp,
            UIComponent openingApp) {
        if (states == null) {
@@ -477,20 +478,18 @@ public class OriginRemoteTransition extends IRemoteTransition.Stub implements
            }
        }

        // Intentionally use a new transaction instead of reusing the existing transaction since we
        // want to apply window animation states first without committing any other pending changes
        // in the existing transaction. The existing transaction is expected to be committed by the
        // Intentionally use the existing transaction since we want to ensure that the window
        // states are applied along with the other surface preparations prior to the animation.
        // The existing transaction is expected to be committed by the
        // onStart() client callback together with client's custom transformation.
        UIComponent.Transaction transaction = closingApp.newTransaction();
        if (!maxClosingBounds.isEmpty()) {
            logD("Applying closing window bounds: " + maxClosingBounds);
            transaction.setBounds(closingApp, maxClosingBounds);
            transactions.setBounds(closingApp, maxClosingBounds);
        }
        if (!maxOpeningBounds.isEmpty()) {
            logD("Applying opening window bounds: " + maxOpeningBounds);
            transaction.setBounds(openingApp, maxOpeningBounds);
            transactions.setBounds(openingApp, maxOpeningBounds);
        }
        transaction.commit();
    }

    @Nullable
@@ -554,7 +553,8 @@ public class OriginRemoteTransition extends IRemoteTransition.Stub implements
            UIComponent openingApp = wrapSurfaces(transitionInfo, /* isOpening= */ true);

            // Restore the pending animation states coming from predictive back transition.
            applyWindowAnimationStates(transitionInfo, states, closingApp, openingApp);
            applyWindowAnimationStates(
                    transitionInfo, states, transactions, closingApp, openingApp);

            // Start.
            onStart(animationController, transactions, origin, closingApp, openingApp);