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

Commit e1a31c94 authored by Evan Rosky's avatar Evan Rosky
Browse files

Don't use sync transactions if not needed

Some common operations (like setting focusability) don't need
to be sync. In fact, sync is causing problems because it causes
other simultaneous operations (like transition animations) to
put some of their operations on the sync transaction instead
of pending. For example, leash-reparent would go on pending,
but activity hide would go on sync.

Additionally, the divider kept re-updating the app bounds
even when they didn't change. This added to the likelihood
that transactions would get mixed-up.

Bug: 158767094
Test: In split-screen landscape, quickly open/close apps in
      secondary split and look for flickers.
Change-Id: I0151e013347e9b30d58a52e8bd6b1401defee572
parent 254dcfd5
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -387,6 +387,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
        }
        // Always set this because we could be entering split when mMinimized is already true
        wct.setFocusable(mSplits.mPrimary.token, !mMinimized);
        boolean onlyFocusable = true;

        // Update home-stack resizability
        final boolean homeResizableChanged = mHomeStackResizable != homeStackResizable;
@@ -395,6 +396,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
            if (isDividerVisible()) {
                WindowManagerProxy.applyHomeTasksMinimized(
                        mSplitLayout, mSplits.mSecondary.token, wct);
                onlyFocusable = false;
            }
        }

@@ -416,8 +418,16 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
            }
        }
        updateTouchable();
        if (onlyFocusable) {
            // If we are only setting focusability, a sync transaction isn't necessary (in fact it
            // can interrupt other animations), so see if it can be submitted on pending instead.
            if (!mSplits.mDivider.getWmProxy().queueSyncTransactionIfWaiting(wct)) {
                WindowOrganizer.applyTransaction(wct);
            }
        } else {
            mWindowManagerProxy.applySyncTransaction(wct);
        }
    }

    void setAdjustedForIme(boolean adjustedForIme) {
        if (mAdjustedForIme == adjustedForIme) {
+44 −39
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.SurfaceControl;
import android.window.TaskOrganizer;
import android.window.WindowContainerToken;
import android.window.WindowContainerTransaction;
import android.window.WindowOrganizer;

import androidx.annotation.Nullable;

@@ -173,6 +174,7 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor
    }

    private void updateImeAdjustState() {
        if (mAdjusted != mTargetAdjusted) {
            // Reposition the server's secondary split position so that it evaluates
            // insets properly.
            WindowContainerTransaction wct = new WindowContainerTransaction();
@@ -212,7 +214,10 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor
                        SCREEN_WIDTH_DP_UNDEFINED, SCREEN_HEIGHT_DP_UNDEFINED);
            }

        mSplits.mDivider.getWmProxy().applySyncTransaction(wct);
            if (!mSplits.mDivider.getWmProxy().queueSyncTransactionIfWaiting(wct)) {
                WindowOrganizer.applyTransaction(wct);
            }
        }

        // Update all the adjusted-for-ime states
        if (!mPaused) {