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

Commit c6043e45 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Fixing Launcher stuck in BACKGROUND_APP state when using overview button

When using overview button, we skip the activtiy animation, which leads
to wrong state. Instead always running the animation and changing the endpoints
accordingly.

Change-Id: Id071b4e74da42c78760519aa29644621afc822e2
parent 0c98d0c0
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
    void onSwipeUpComplete(T activity);

    AnimationFactory prepareRecentsUI(T activity, boolean activityVisible,
            Consumer<AnimatorPlaybackController> callback);
            boolean animateActivity, Consumer<AnimatorPlaybackController> callback);

    ActivityInitListener createActivityInitListener(BiPredicate<T, Boolean> onInitListener);

@@ -214,7 +214,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {

        @Override
        public AnimationFactory prepareRecentsUI(Launcher activity, boolean activityVisible,
                Consumer<AnimatorPlaybackController> callback) {
                boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
            final LauncherState startState = activity.getStateManager().getState();

            LauncherState resetState = startState;
@@ -228,8 +228,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
                // Since the launcher is not visible, we can safely reset the scroll position.
                // This ensures then the next swipe up to all-apps starts from scroll 0.
                activity.getAppsView().reset(false /* animate */);
                fromState = BACKGROUND_APP;
                activity.getStateManager().goToState(BACKGROUND_APP, false);
                fromState = animateActivity ? BACKGROUND_APP : OVERVIEW;
                activity.getStateManager().goToState(fromState, false);

                // Optimization, hide the all apps view to prevent layout while initializing
                activity.getAppsView().getContentView().setVisibility(View.GONE);
@@ -268,6 +268,9 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
                        .createAnimationToNewWorkspace(fromState, endState, accuracy));
                return;
            }
            if (fromState == endState) {
                return;
            }

            AnimatorSet anim = new AnimatorSet();
            if (!activity.getDeviceProfile().isVerticalBarLayout()) {
@@ -470,7 +473,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {

        @Override
        public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible,
                Consumer<AnimatorPlaybackController> callback) {
                boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
            if (activityVisible) {
                return (transitionLength, interactionType) -> { };
            }
+2 −4
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ public class OverviewCommandHelper {
            activity.<RecentsView>getOverviewPanel().setCurrentTask(mRunningTaskId);
            AbstractFloatingView.closeAllOpenViews(activity, wasVisible);
            AnimationFactory factory = mHelper.prepareRecentsUI(activity, wasVisible,
                    (controller) -> {
                    false /* animate activity */, (controller) -> {
                        controller.dispatchOnStart();
                        ValueAnimator anim = controller.getAnimationPlayer()
                                .setDuration(RECENTS_LAUNCH_DURATION);
@@ -277,9 +277,7 @@ public class OverviewCommandHelper {
                        anim.start();
                });
            factory.onRemoteAnimationReceived(null);
            if (wasVisible) {
            factory.createActivityController(RECENTS_LAUNCH_DURATION, INTERACTION_NORMAL);
            }
            mActivity = activity;
            mRecentsView = mActivity.getOverviewPanel();
            mRecentsView.setRunningTaskIconScaledDown(true);
+1 −1
Original line number Diff line number Diff line
@@ -418,7 +418,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
        }

        mAnimationFactory = mActivityControlHelper.prepareRecentsUI(mActivity,
                mWasLauncherAlreadyVisible, this::onAnimatorPlaybackControllerCreated);
                mWasLauncherAlreadyVisible, true, this::onAnimatorPlaybackControllerCreated);
        AbstractFloatingView.closeAllOpenViews(activity, mWasLauncherAlreadyVisible);

        if (mWasLauncherAlreadyVisible) {