From 08a9bcac1f8400b44356ad4da445de8d7f360578 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Sat, 17 Sep 2022 16:01:46 -0700 Subject: [PATCH] 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 --- .../BaseRecentsViewStateController.java | 5 +++++ .../fallback/FallbackRecentsStateController.java | 5 +++++ .../quickstep/fallback/FallbackRecentsView.java | 5 ----- .../quickstep/views/LauncherRecentsView.java | 5 ----- .../launcher3/statemanager/StateManager.java | 16 ---------------- 5 files changed, 10 insertions(+), 26 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index 2e4e7397aa..8fb70300f6 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -88,6 +88,11 @@ public abstract class BaseRecentsViewStateController return; } setStateWithAnimationInternal(toState, config, builder); + builder.addEndListener(success -> { + if (!success) { + mRecentsView.reset(); + } + }); } /** diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 1e0ceed4cd..19a6c38901 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -78,6 +78,11 @@ public class FallbackRecentsStateController implements StateHandler mRecentsView.loadVisibleTaskData(FLAG_UPDATE_ALL)); + setter.addEndListener(success -> { + if (!success) { + mRecentsView.reset(); + } + }); mRecentsView.updateEmptyMessage(); setProperties(toState, config, setter); diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index e9819935aa..1984ed8513 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -229,11 +229,6 @@ public class FallbackRecentsView extends RecentsView> { onStateTransitionEnd(state); } - @Override - public void onAnimationCancel(Animator animation) { - super.onAnimationCancel(animation); - onStateTransitionFailed(state); - } }; } @@ -360,12 +355,6 @@ public class StateManager> { } } - 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> { 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) { } }