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

Commit 08a9bcac authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Fix issue with Overview thumbnails appearing blank in certain situations

This CL fixes an issue where canceling any Launcher animation by entering Quick Switch would cause Overview to appear with all thumbnail tiles blank.

The issue occurred because we recently added a reset() to Overview that triggered on all state transition animation cancels. This fixed some issues, but introduced this bug.

Fixed by tailoring the reset() to only fire on animation cancels within BaseRecentsView and FallbackRecentsView.

Fixes: 246232494
Fixes: 243471493
Test: Manual
Change-Id: I175a22d52597a63e164a6f3b9353c62b199b0712
parent ade8b9d7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -88,6 +88,11 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
            return;
        }
        setStateWithAnimationInternal(toState, config, builder);
        builder.addEndListener(success -> {
            if (!success) {
                mRecentsView.reset();
            }
        });
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -78,6 +78,11 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
        }
        // While animating into recents, update the visible task data as needed
        setter.addOnFrameCallback(() -> mRecentsView.loadVisibleTaskData(FLAG_UPDATE_ALL));
        setter.addEndListener(success -> {
            if (!success) {
                mRecentsView.reset();
            }
        });
        mRecentsView.updateEmptyMessage();

        setProperties(toState, config, setter);
+0 −5
Original line number Diff line number Diff line
@@ -229,11 +229,6 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
        setFreezeViewVisibility(true);
    }

    @Override
    public void onStateTransitionFailed(RecentsState toState) {
        reset();
    }

    @Override
    public void onStateTransitionComplete(RecentsState finalState) {
        if (finalState == HOME) {
+0 −5
Original line number Diff line number Diff line
@@ -119,11 +119,6 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
        setFreezeViewVisibility(true);
    }

    @Override
    public void onStateTransitionFailed(LauncherState toState) {
        reset();
    }

    @Override
    public void onStateTransitionComplete(LauncherState finalState) {
        if (finalState == NORMAL || finalState == SPRING_LOADED) {
+0 −16
Original line number Diff line number Diff line
@@ -343,11 +343,6 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> {
                onStateTransitionEnd(state);
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                super.onAnimationCancel(animation);
                onStateTransitionFailed(state);
            }
        };
    }

@@ -360,12 +355,6 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> {
        }
    }

    private void onStateTransitionFailed(STATE_TYPE state) {
        for (int i = mListeners.size() - 1; i >= 0; i--) {
            mListeners.get(i).onStateTransitionFailed(state);
        }
    }

    private void onStateTransitionEnd(STATE_TYPE state) {
        // Only change the stable states after the transitions have finished
        if (state != mCurrentStableState) {
@@ -600,11 +589,6 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> {

        default void onStateTransitionStart(STATE_TYPE toState) { }

        /**
         * If the state transition animation fails (e.g. is canceled by the user), this fires.
         */
        default void onStateTransitionFailed(STATE_TYPE toState) { }

        default void onStateTransitionComplete(STATE_TYPE finalState) { }
    }