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 13:29:42 -0800
commit7366b99644fa61279591eec54ea725d86d6e2e93 (patch)
tree56b1080ebc2e16e19298fe824de7934f111d8a83
parent4b45f29b596aa5ea9076eb18c63324ad27172c78 (diff)
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
-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 37cc0d22c063..27683b2fcff2 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -1504,16 +1504,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.