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

Commit b33471a2 authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Fix bug with Launcher animation canceling, esp. around OverviewSplitSelect

This commit fixes a bug where the user could cancel animations when transitioning between Launcher states, potentially resulting in a state where Overview elements (task thumbnails etc.) were wrongly hidden or invisible.

The bug occurred because functions such as createInitialSplitSelectAnimation() and createAtomicAnimation() did not carry out any cleanup upon animation failure. This resulted in RecentsView potentially being in a polluted state for the next launch.

Bug was fixed by adding cleanup routines to two onAnimationEnd listeners.

Fixes: 242715097
Test: Manual
Change-Id: I05415ecf515e247aa535e3ca8371e540c3189b01
parent c9be6ca8
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -28,11 +28,10 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SP
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
import static com.android.quickstep.views.FloatingTaskView.PRIMARY_TRANSLATE_OFFSCREEN;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
import static com.android.quickstep.views.RecentsView.FIRST_FLOATING_TASK_TRANSLATE_OFFSCREEN;
import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
import static com.android.quickstep.views.RecentsView.SPLIT_INSTRUCTIONS_FADE;
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
import static com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA;

@@ -112,6 +111,7 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
            // TODO (b/238651489): Refactor state management to avoid need for double check
            FloatingTaskView floatingTask = mRecentsView.getFirstFloatingTaskView();
            if (floatingTask != null) {
                // We are in split selection state currently, transitioning to another state
                DragLayer dragLayer = mLauncher.getDragLayer();
                RectF onScreenRectF = new RectF();
                Utilities.getBoundsForViewInDragLayer(mLauncher.getDragLayer(), floatingTask,
@@ -127,8 +127,8 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
                );

                setter.setFloat(
                        mRecentsView,
                        FIRST_FLOATING_TASK_TRANSLATE_OFFSCREEN,
                        mRecentsView.getFirstFloatingTaskView(),
                        PRIMARY_TRANSLATE_OFFSCREEN,
                        mRecentsView.getPagedOrientationHandler()
                                .getFloatingTaskOffscreenTranslationTarget(
                                        floatingTask,
@@ -140,14 +140,14 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
                                ANIM_OVERVIEW_SPLIT_SELECT_FLOATING_TASK_TRANSLATE_OFFSCREEN,
                                LINEAR
                        ));
                setter.setFloat(
                        mRecentsView,
                        SPLIT_INSTRUCTIONS_FADE,
                        1,
                setter.setViewAlpha(
                        mRecentsView.getSplitInstructionsView(),
                        0,
                        config.getInterpolator(
                                ANIM_OVERVIEW_SPLIT_SELECT_INSTRUCTIONS_FADE,
                                LINEAR
                        ));
                        )
                );
            }
        }

+5 −0
Original line number Diff line number Diff line
@@ -226,6 +226,11 @@ 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) {
+24 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
@@ -49,6 +50,29 @@ import com.android.systemui.shared.system.QuickStepContract;
 */
public class FloatingTaskView extends FrameLayout {

    public static final FloatProperty<FloatingTaskView> PRIMARY_TRANSLATE_OFFSCREEN =
            new FloatProperty<FloatingTaskView>("floatingTaskPrimaryTranslateOffscreen") {
        @Override
        public void setValue(FloatingTaskView view, float translation) {
            ((RecentsView) view.mActivity.getOverviewPanel()).getPagedOrientationHandler()
                    .setFloatingTaskPrimaryTranslation(
                            view,
                            translation,
                            view.mActivity.getDeviceProfile()
                    );
        }

        @Override
        public Float get(FloatingTaskView view) {
            return ((RecentsView) view.mActivity.getOverviewPanel())
                    .getPagedOrientationHandler()
                    .getFloatingTaskPrimaryTranslation(
                            view,
                            view.mActivity.getDeviceProfile()
                    );
        }
    };

    private FloatingTaskThumbnailView mThumbnailView;
    private SplitPlaceholderView mSplitPlaceholderView;
    private RectF mStartingPosition;
+6 −0
Original line number Diff line number Diff line
@@ -319,4 +319,10 @@ public class GroupedTaskView extends TaskView {
        super.applyThumbnailSplashAlpha();
        mSnapshotView2.setSplashAlpha(mTaskThumbnailSplashAlpha);
    }

    @Override
    void setThumbnailVisibility(int visibility) {
        super.setThumbnailVisibility(visibility);
        mSnapshotView2.setVisibility(visibility);
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -119,6 +119,11 @@ 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) {
Loading