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

Commit 5fac02bc authored by Tony Wickham's avatar Tony Wickham
Browse files

Fix some touch issues during gesture nav transition

- Don't recreate the laucher transition controller if we've already ended it, as it could clobber a touch interaction that started in the meantime
  - Test: swipe up from an app to overivew, swipe to dismiss it during the transition.
  - Previously, we were ending the controller twice (once on touch down as we started proxying, and again in setupLauncherUiAfterSwipeUpToRecentsAnimation()), and the second one could happen after starting the dismiss interaction.

- Don't recreateControllers() if orientation didn't change
  - Test: swipe up to go from an app to home, swipe up to all apps during the transition.
  - Previously, we were getting the following sequence:
    1. Touch down on home to start swiping to all apps - all current controllers get this down event to start determining whether to intercept
    2. Before reaching touch slop, we recreateControllers(), so all new controllers won't get the down event and thus won't intercept
  - Now, we avoid unnecessarily recreateControllers(), so the original controllers can still intercept.

Test: see above
Fixes: 189700453
Change-Id: I7b5fb3d21ab7a7a7044fcec7f2c1e39afe23c5dd
parent d35dcdec
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -231,6 +231,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,

    // Used to control launcher components throughout the swipe gesture.
    private AnimatorControllerWithResistance mLauncherTransitionController;
    private boolean mHasEndedLauncherTransition;

    private AnimationFactory mAnimationFactory = (t) -> { };

@@ -615,11 +616,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,

    /**
     * We don't want to change mLauncherTransitionController if mGestureState.getEndTarget() == HOME
     * (it has its own animation).
     * (it has its own animation) or if we explicitly ended the controller already.
     * @return Whether we can create the launcher controller or update its progress.
     */
    private boolean canCreateNewOrUpdateExistingLauncherTransitionController() {
        return mGestureState.getEndTarget() != HOME;
        return mGestureState.getEndTarget() != HOME && !mHasEndedLauncherTransition;
    }

    @Override
@@ -1436,6 +1437,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
    }

    private void endLauncherTransitionController() {
        mHasEndedLauncherTransition = true;

        if (mLauncherTransitionController != null) {
            // End the animation, but stay at the same visual progress.
            mLauncherTransitionController.getNormalController().dispatchSetInterpolator(
+14 −2
Original line number Diff line number Diff line
@@ -1247,8 +1247,14 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    }

    private void updateOrientationHandler() {
        updateOrientationHandler(true);
    }

    private void updateOrientationHandler(boolean forceRecreateDragLayerControllers) {
        // Handle orientation changes.
        PagedOrientationHandler oldOrientationHandler = mOrientationHandler;
        mOrientationHandler = mOrientationState.getOrientationHandler();

        mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources());
        setLayoutDirection(mIsRtl
                ? View.LAYOUT_DIRECTION_RTL
@@ -1257,7 +1263,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
                ? View.LAYOUT_DIRECTION_LTR
                : View.LAYOUT_DIRECTION_RTL);
        mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated());

        if (forceRecreateDragLayerControllers
                || !mOrientationHandler.equals(oldOrientationHandler)) {
            // Changed orientations, update controllers so they intercept accordingly.
            mActivity.getDragLayer().recreateControllers();
        }

        boolean isInLandscape = mOrientationState.getTouchRotation() != ROTATION_0
                || mOrientationState.getRecentsActivityRotation() != ROTATION_0;
        mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
@@ -1577,7 +1589,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
            setCurrentPage(0);
            LayoutUtils.setViewEnabled(mActionsView, true);
            if (mOrientationState.setGestureActive(false)) {
                updateOrientationHandler();
                updateOrientationHandler(/* forceRecreateDragLayerControllers = */ false);
            }
        });
    }