summaryrefslogtreecommitdiffstats
path: root/quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java
diff options
context:
space:
mode:
Diffstat (limited to 'quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java')
-rw-r--r--quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java b/quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java
index 30b10b0ea..34d42ac92 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java
@@ -20,6 +20,8 @@ import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.util.UiThreadHelper;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
+
+import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
/**
@@ -27,6 +29,10 @@ import java.util.concurrent.ExecutorService;
*/
public class RecentsAnimationWrapper {
+ // A list of callbacks to run when we receive the recents animation target. There are different
+ // than the state callbacks as these run on the current worker thread.
+ private final ArrayList<Runnable> mCallbacks = new ArrayList<>();
+
public RemoteAnimationTargetSet targetSet;
private RecentsAnimationControllerCompat mController;
@@ -46,6 +52,21 @@ public class RecentsAnimationWrapper {
if (mInputConsumerEnabled) {
enableInputConsumer();
}
+
+ if (!mCallbacks.isEmpty()) {
+ for (Runnable action : new ArrayList<>(mCallbacks)) {
+ action.run();
+ }
+ mCallbacks.clear();
+ }
+ }
+
+ public synchronized void runOnInit(Runnable action) {
+ if (targetSet == null) {
+ mCallbacks.add(action);
+ } else {
+ action.run();
+ }
}
/**