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

Commit c4b7983f authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Use self sync transaction for assignLayer" into main

parents f1610eff 244c4cf7
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ import com.android.server.wm.SurfaceAnimator.Animatable;
import com.android.server.wm.SurfaceAnimator.AnimationType;
import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;
import com.android.server.wm.utils.AlwaysTruePredicate;
import com.android.window.flags.Flags;

import java.io.PrintWriter;
import java.lang.ref.WeakReference;
@@ -2736,6 +2737,13 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        if (!mTransitionController.canAssignLayers(this)) return;
        final boolean changed = layer != mLastLayer || mLastRelativeToLayer != null;
        if (mSurfaceControl != null && changed) {
            if (Flags.useSelfSyncTransactionForLayer() && mSyncState != SYNC_STATE_NONE) {
                // When this container needs to be synced, assign layer with its own sync
                // transaction to avoid out of ordering when merge.
                // Still use the passed-in transaction for non-sync case, such as building finish
                // transaction.
                t = getSyncTransaction();
            }
            setLayer(t, layer);
            mLastLayer = layer;
            mLastRelativeToLayer = null;
@@ -2746,6 +2754,13 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
            boolean forceUpdate) {
        final boolean changed = layer != mLastLayer || mLastRelativeToLayer != relativeTo;
        if (mSurfaceControl != null && (changed || forceUpdate)) {
            if (Flags.useSelfSyncTransactionForLayer() && mSyncState != SYNC_STATE_NONE) {
                // When this container needs to be synced, assign layer with its own sync
                // transaction to avoid out of ordering when merge.
                // Still use the passed-in transaction for non-sync case, such as building finish
                // transaction.
                t = getSyncTransaction();
            }
            setRelativeLayer(t, relativeTo, layer);
            mLastLayer = layer;
            mLastRelativeToLayer = relativeTo;
+7 −0
Original line number Diff line number Diff line
@@ -5562,6 +5562,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    @Override
    void assignLayer(Transaction t, int layer) {
        if (mStartingData != null) {
            if (Flags.useSelfSyncTransactionForLayer() && mSyncState != SYNC_STATE_NONE) {
                // When this container needs to be synced, assign layer with its own sync
                // transaction to avoid out of ordering when merge.
                // Still use the passed-in transaction for non-sync case, such as building finish
                // transaction.
                t = getSyncTransaction();
            }
            // The starting window should cover the task.
            t.setLayer(mSurfaceControl, Integer.MAX_VALUE);
            return;
+2 −0
Original line number Diff line number Diff line
@@ -1269,6 +1269,7 @@ public class WindowContainerTests extends WindowTestsBase {
        final SurfaceControl.Transaction t = mock(SurfaceControl.Transaction.class);
        spyOn(container);
        spyOn(surfaceAnimator);
        doReturn(t).when(container).getSyncTransaction();

        // Trigger for first relative layer call.
        container.assignRelativeLayer(t, relativeParent, 1 /* layer */);
@@ -1295,6 +1296,7 @@ public class WindowContainerTests extends WindowTestsBase {
        spyOn(container);
        spyOn(surfaceAnimator);
        spyOn(surfaceFreezer);
        doReturn(t).when(container).getSyncTransaction();

        container.setLayer(t, 1);
        container.setRelativeLayer(t, relativeParent, 2);