From 8e653c84066928d545518ee2109b6a84d5109ea8 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 13 May 2020 13:25:51 -0700 Subject: [PATCH] applySyncTransaction: Add to syncSet earlier We need to add modified WindowContainers to the BLASTSync set before applying any changes. Recall that while participating in sync window containers stop using the Display global pending-transaction and instead redirect their changes in to the BLASTSync-transaction. If we add to the BLAST sync too late, some changes could go in to the WM transaction while others go in to the BLASTSync-transaction. This means the effects would not be applied atomically. Bug: 149946388 Bug: 155814541 Test: Expand PIP. No flash. Change-Id: I9b9b8f2308098d045a44004e2cca6dcbf84efcd9 --- .../android/server/wm/WindowOrganizerController.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java index c4cb4b5091d82..707a7898f8b6c 100644 --- a/services/core/java/com/android/server/wm/WindowOrganizerController.java +++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java @@ -138,6 +138,13 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub Slog.e(TAG, "Attempt to operate on detached container: " + wc); continue; } + // Make sure we add to the syncSet before performing + // operations so we don't end up splitting effects between the WM + // pending transaction and the BLASTSync transaction. + if (syncId >= 0) { + mBLASTSyncEngine.addToSyncSet(syncId, wc); + } + int containerEffect = applyWindowContainerChange(wc, entry.getValue()); effects |= containerEffect; @@ -146,9 +153,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub && (containerEffect & TRANSACT_EFFECTS_CLIENT_CONFIG) != 0) { haveConfigChanges.add(wc); } - if (syncId >= 0) { - mBLASTSyncEngine.addToSyncSet(syncId, wc); - } } // Hierarchy changes final List hops = t.getHierarchyOps();