summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2025-01-24 05:37:23 +0000
committer Vishnu Nair <vishnun@google.com> 2025-01-24 15:27:38 -0800
commit806927c67cbb308739b06efe78ee474c83b66e24 (patch)
treeacc0e79e11be9d089727672428363eda1ab7e61a
parent4e372612f85e70d0092c346f0e921682c5906dc8 (diff)
DO NOT MERGE: Update ActivityRecordInputSink using the pending transaction
In some cases where finishTransition happens before the pending transaction is applied, we can end up with a stale state. Subsequent prepareSurfaces does not fix the issue because the InputWindowHandle is only applied on changes. Fix the race by only using pending transactions to apply ActivityRecordInputSink state changes. Bug: 332277530 Test: POC from bug Flag: EXEMPT bug fix Change-Id: If93840ad7b2abbcb48c0c332870c48046c0f8fdc Merged-In: If93840ad7b2abbcb48c0c332870c48046c0f8fdc
-rw-r--r--services/core/java/com/android/server/wm/Transition.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 2ac3125de961..6037fa55d78f 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -1240,16 +1240,15 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
}
// Update the input-sink (touch-blocking) state now that the animation is finished.
- SurfaceControl.Transaction inputSinkTransaction = null;
+ boolean scheduleAnimation = false;
for (int i = 0; i < mParticipants.size(); ++i) {
final ActivityRecord ar = mParticipants.valueAt(i).asActivityRecord();
if (ar == null || !ar.isVisible() || ar.getParent() == null) continue;
- if (inputSinkTransaction == null) {
- inputSinkTransaction = ar.mWmService.mTransactionFactory.get();
- }
- ar.mActivityRecordInputSink.applyChangesToSurfaceIfChanged(inputSinkTransaction);
+ scheduleAnimation = true;
+ ar.mActivityRecordInputSink.applyChangesToSurfaceIfChanged(ar.getPendingTransaction());
}
- if (inputSinkTransaction != null) inputSinkTransaction.apply();
+ // To apply pending transactions.
+ if (scheduleAnimation) mController.mAtm.mWindowManager.scheduleAnimationLocked();
// Always schedule stop processing when transition finishes because activities don't
// stop while they are in a transition thus their stop could still be pending.