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

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

If relayout calculates a new configuration, cancel draw

Previously, we were only doing this for buffer sync; however,
this actually applies to all relayouts now that we use seqId
for all updates. While the always-seq-id prevented us from
presenting the out-dated content (which would be a flicker),
this CL also prevents us from wasting time drawing the content
altogether.

Bug: 435801229
Bug: 385976595
Test: run perf comparison
Flag: com.android.window.flags.always_seq_id_layout
Change-Id: I5d92120462a8457f9227ae31d4b078590a59f386
parent 5efa5630
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -2621,7 +2621,6 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            }


            final int oldVisibility = win.mViewVisibility;
            final int oldVisibility = win.mViewVisibility;
            final int oldBufferSeqId = win.mBufferSeqId;


            // If the window is becoming visible, visibleOrAdding may change which may in turn
            // If the window is becoming visible, visibleOrAdding may change which may in turn
            // change the IME layering target.
            // change the IME layering target.
@@ -2850,9 +2849,9 @@ public class WindowManagerService extends IWindowManager.Stub
                            : -1;
                            : -1;
                    win.markRedrawForSyncReported();
                    win.markRedrawForSyncReported();
                } else {
                } else {
                    if (win.mBufferSeqId > oldBufferSeqId) {
                    if (mAlwaysSeqId && win.cancelAndRedraw(syncSeqId)) {
                        // A sync was started so this current layout is invalid until subsequent
                        // Surface-placement has resulted in a new configuration or a new sync,
                        // reportResized.
                        // so this current layout is invalid until subsequent reportResized.
                        result |= RELAYOUT_RES_CANCEL_AND_REDRAW;
                        result |= RELAYOUT_RES_CANCEL_AND_REDRAW;
                    }
                    }
                    outRelayoutResult.syncSeqId = -1;
                    outRelayoutResult.syncSeqId = -1;