Defer nav handle action until after the recents transition is complete

Bug: 303078360
Test: Force delay in finishing recents transition and verify with bug steps
Change-Id: I2021cc291204261de56ef9c912d8b5935059c7fb
Signed-off-by: Winson Chung <winsonc@google.com>
This commit is contained in:
Winson Chung committed 2023-10-06 03:42:35 +00:00
1 parent 528356e744
commit 4f17c97d03
7 files changed
+58 -11

No files matched your search

@@ -125,6 +125,9 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
// Might be displacement in X or Y, depending on the direction we are swiping from the nav bar.
private float mStartDisplacement;
// The callback called upon finishing the recents transition if it was force-canceled
private Runnable mForceFinishRecentsTransitionCallback;
public OtherActivityInputConsumer(Context base, RecentsAnimationDeviceState deviceState,
TaskAnimationManager taskAnimationManager, GestureState gestureState,
boolean isDeferredDownTarget, Consumer<OtherActivityInputConsumer> onCompleteCallback,
@@ -444,7 +447,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
// animateToProgress so we have to manually finish here. In the case of
// ACTION_CANCEL, someone else may be doing something so finish synchronously.
mTaskAnimationManager.finishRunningRecentsAnimation(false /* toHome */,
isCanceled /* forceFinish */);
isCanceled /* forceFinish */, mForceFinishRecentsTransitionCallback);
} else {
// The animation hasn't started yet, so insert a replacement handler into the
// callbacks which immediately finishes the animation after it starts.
@@ -512,6 +515,14 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
return !mPassedPilferInputSlop;
}
/**
* Sets a callback to be called when the recents transition is force-canceled by another input
* consumer being made active.
*/
public void setForceFinishRecentsTransitionCallback(Runnable r) {
mForceFinishRecentsTransitionCallback = r;
}
/**
* A listener which just finishes the animation immediately after starting. Replaces
* AbsSwipeUpHandler if the gesture itself finishes before the animation even starts.