Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e449008 authored by Winson Chung's avatar Winson Chung
Browse files

Continue gestures on interaction after recents animation finishes

- Detect when start of the next task is interrupted with another gesture
  (after finishing the recents animation but before the next task is
  launched), and ensure that the next gesture is continued with another
  other activity input consumer (but without actual remote animation
  targets)

Bug: 128376812
Test: Introduce artificial delay in recents animation finish, try to quick
      switch quickly

Change-Id: I057a0b2c4b7e8636467e37f5bbc8800b46c24345
parent 227b6e02
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
     * @param wasVisible true if it was visible before
     */
    boolean onActivityReady(T activity, Boolean wasVisible) {
        activity.<RecentsView>getOverviewPanel().setCurrentTask(mTargetTaskId);
        activity.<RecentsView>getOverviewPanel().showCurrentTask(mTargetTaskId);
        AbstractFloatingView.closeAllOpenViews(activity, wasVisible);
        ActivityControlHelper.AnimationFactory factory =
                mHelper.prepareRecentsUI(activity, wasVisible,
+1 −1
Original line number Diff line number Diff line
@@ -382,7 +382,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
            mSwipeSharedState.canGestureBeContinued = endTarget != null && endTarget.canBeContinued;
            mSwipeSharedState.goingToLauncher = endTarget != null && endTarget.isLauncher;
            if (mSwipeSharedState.canGestureBeContinued) {
                mInteractionHandler.cancelCurrentAnimation();
                mInteractionHandler.cancelCurrentAnimation(mSwipeSharedState);
            } else {
                mInteractionHandler.reset();
            }
+4 −0
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ public class RecentsAnimationWrapper {
        mInputProxySupplier = inputProxySupplier;
    }

    public boolean hasTargets() {
        return targetSet != null && targetSet.hasTargets();
    }

    @UiThread
    public synchronized void setController(SwipeAnimationTargetSet targetSet) {
        Preconditions.assertUIThread();
+15 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ public class SwipeSharedState implements SwipeAnimationListener {

    public boolean canGestureBeContinued;
    public boolean goingToLauncher;
    public boolean recentsAnimationFinishInterrupted;
    public int nextRunningTaskId = -1;

    public SwipeSharedState(OverviewComponentObserver overviewComponentObserver) {
        mOverviewComponentObserver = overviewComponentObserver;
@@ -114,9 +116,22 @@ public class SwipeSharedState implements SwipeAnimationListener {
        }
    }

    /**
     * Called when a recents animation has finished, but was interrupted before the next task was
     * launched. The given {@param runningTaskId} should be used as the running task for the
     * continuing input consumer.
     */
    public void setRecentsAnimationFinishInterrupted(int runningTaskId) {
        recentsAnimationFinishInterrupted = true;
        nextRunningTaskId = runningTaskId;
        mLastAnimationTarget = mLastAnimationTarget.cloneWithoutTargets();
    }

    public void clearAllState() {
        clearListenerState();
        canGestureBeContinued = false;
        recentsAnimationFinishInterrupted = false;
        nextRunningTaskId = -1;
        goingToLauncher = false;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ public final class TaskViewUtils {

            @Override
            public void onUpdate(float percent) {
                // TODO: Take into account the current fullscreen progress for animating the insets
                params.setProgress(1 - percent);
                RectF taskBounds = inOutHelper.applyTransform(targetSet, params);
                if (!skipViewChanges) {
Loading