From de1b42b957227cea81e2cea27e42415d62188a9a Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 10 May 2023 23:07:01 +0000 Subject: [PATCH] Only refresh the launcher resume state when the task launch fails - The previous call from TaskbarLauncherStateController caused a regression due to the inability for the code to distinguish Normal -> Background -> Normal when tapping on the bar area or from failing to launch a task, so both cases were triggering the resumed state to cycle and start an animation. For now we can only handle the task-launch fail case. Bug: 268448123 Fixes: 281966662 Test: Quickswitch to an activity that finishes when resumed Change-Id: Ie4692dd85252540ff47633978c0e6e4adbb1bdd0 --- .../launcher3/taskbar/LauncherTaskbarUIController.java | 4 ++++ .../launcher3/taskbar/TaskbarLauncherStateController.java | 4 ---- .../com/android/launcher3/taskbar/TaskbarUIController.java | 5 +++++ quickstep/src/com/android/quickstep/views/TaskView.java | 7 +++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index fdef39f2eb..ba6f1651ed 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -197,6 +197,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController { return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation); } + public void refreshResumedState() { + onLauncherResumedOrPaused(mLauncher.hasBeenResumed()); + } + /** * Create Taskbar animation when going from an app to Launcher as part of recents transition. * @param toState If known, the state we will end up in when reaching Launcher. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 75cfd05d41..ed78e2d238 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -207,10 +207,6 @@ public class TaskbarLauncherStateController { com.android.launcher3.taskbar.Utilities.setOverviewDragState( mControllers, finalState.disallowTaskbarGlobalDrag(), disallowLongClick, finalState.allowTaskbarInitialSplitSelection()); - // LauncherTaskbarUIController depends on the state when checking whether - // to handle resume, so it should also be poked if current state changes - mLauncher.getTaskbarUIController().onLauncherResumedOrPaused( - mLauncher.hasBeenResumed()); } }; diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index f3e2ee2e9d..f3513fdb97 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -318,4 +318,9 @@ public class TaskbarUIController { } return null; } + + /** + * Refreshes the resumed state of this ui controller. + */ + public void refreshResumedState() {} } diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 134ef6cce3..d57070847b 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -849,6 +849,13 @@ public class TaskView extends FrameLayout implements Reusable { // QuickstepTransitionManager.createWallpaperOpenAnimations when launcher // shows again getRecentsView().startHome(false /* animated */); + RecentsView rv = getRecentsView(); + if (rv != null && rv.mSizeStrategy.getTaskbarController() != null) { + // LauncherTaskbarUIController depends on the launcher state when checking + // whether to handle resume, but that can come in before startHome() changes + // the state, so force-refresh here to ensure the taskbar is updated + rv.mSizeStrategy.getTaskbarController().refreshResumedState(); + } }); } // Indicate success once the system has indicated that the transition has started