Merge "ViewRootImpl: Ensure seqId only increases" into tm-dev

This commit is contained in:
Rob Carr
2022-04-06 04:53:55 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 5 deletions

View File

@@ -1742,7 +1742,7 @@ public final class ViewRootImpl implements ViewParent,
mForceNextWindowRelayout = forceNextWindowRelayout;
mPendingAlwaysConsumeSystemBars = args.argi2 != 0;
mSyncSeqId = args.argi4;
mSyncSeqId = args.argi4 > mSyncSeqId ? args.argi4 : mSyncSeqId;
if (msg == MSG_RESIZED_REPORT) {
reportNextDraw();
@@ -7986,7 +7986,10 @@ public final class ViewRootImpl implements ViewParent,
insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0,
mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, mTempInsets,
mTempControls, mRelayoutBundle);
mSyncSeqId = mRelayoutBundle.getInt("seqid");
final int maybeSyncSeqId = mRelayoutBundle.getInt("seqid");
if (maybeSyncSeqId > 0) {
mSyncSeqId = maybeSyncSeqId;
}
if (mTranslator != null) {
mTranslator.translateRectInScreenToAppWindow(mTmpFrames.frame);

View File

@@ -6125,14 +6125,21 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
applyHere = true;
}
for (int i = mDrawHandlers.size() - 1; i >= 0; i--) {
DrawHandler h = mDrawHandlers.get(i);
final List<DrawHandler> handlersToRemove = new ArrayList<>();
// Iterate forwards to ensure we process in the same order
// we added.
for (int i = 0; i < mDrawHandlers.size(); i++) {
final DrawHandler h = mDrawHandlers.get(i);
if (h.mSeqId <= seqId) {
h.mConsumer.accept(t);
mDrawHandlers.remove(h);
handlersToRemove.add(h);
hadHandlers = true;
}
}
for (int i = 0; i < handlersToRemove.size(); i++) {
final DrawHandler h = handlersToRemove.get(i);
mDrawHandlers.remove(h);
}
if (hadHandlers) {
mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);