From 3cecfd077c02630e1bb5345192b9e7efce427180 Mon Sep 17 00:00:00 2001 From: Sukesh Ram Date: Tue, 5 Nov 2024 11:36:53 -0800 Subject: [PATCH] Fix Taskbar 3 Button y position on launcher home pause/resume When app launcher pauses (not on app entry, but whilst home), we want to move the taskbar buttons to 3-button mode to avoid overlap with any popup UI (usually in the form of bottom sheets). To avoid overriding existing app entry animations, this is only implemented for cases of launcher pause without a launcher stop. Flag: EXEMPT bugfix Bug: 373977342 Bug: 374058222 Test: Manual Change-Id: I727173b0ae7f3f8e23b1da6755ceda6493b311cb --- .../taskbar/LauncherTaskbarUIController.java | 43 ++++++++++++++++++- .../uioverrides/QuickstepLauncher.java | 16 +++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index c5be13dbe1..ae438ab0d4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -69,14 +69,17 @@ public class LauncherTaskbarUIController extends TaskbarUIController { public static final int ALL_APPS_PAGE_PROGRESS_INDEX = 1; public static final int WIDGETS_PAGE_PROGRESS_INDEX = 2; public static final int SYSUI_SURFACE_PROGRESS_INDEX = 3; + public static final int LAUNCHER_PAUSE_PROGRESS_INDEX = 4; - public static final int DISPLAY_PROGRESS_COUNT = 4; + public static final int DISPLAY_PROGRESS_COUNT = 5; private final AnimatedFloat mTaskbarInAppDisplayProgress = new AnimatedFloat( this::onInAppDisplayProgressChanged); private final MultiPropertyFactory mTaskbarInAppDisplayProgressMultiProp = new MultiPropertyFactory<>(mTaskbarInAppDisplayProgress, AnimatedFloat.VALUE, DISPLAY_PROGRESS_COUNT, Float::max); + private final AnimatedFloat mLauncherPauseProgress = new AnimatedFloat( + this::onLauncherPauseProgressUpdate); private final QuickstepLauncher mLauncher; private final HomeVisibilityState mHomeState; @@ -498,7 +501,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController { "MINUS_ONE_PAGE_PROGRESS_INDEX", "ALL_APPS_PAGE_PROGRESS_INDEX", "WIDGETS_PAGE_PROGRESS_INDEX", - "SYSUI_SURFACE_PROGRESS_INDEX"); + "SYSUI_SURFACE_PROGRESS_INDEX", + "LAUNCHER_PAUSE_PROGRESS_INDEX"); mTaskbarLauncherStateController.dumpLogs(prefix + "\t", pw); } @@ -528,4 +532,39 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mLauncher.getWorkspace().onOverlayScrollChanged(0); } } + + /** + * Called when Launcher Activity resumed while staying at home. + *

+ * Shift nav buttons up to at-home position. + */ + public void onLauncherResume() { + mLauncherPauseProgress.animateToValue(0.0f).start(); + } + + /** + * Called when Launcher Activity paused while staying at home. + *

+ * To avoid UI clash between taskbar & bottom sheet, shift nav buttons down to in-app position. + */ + public void onLauncherPause() { + mLauncherPauseProgress.animateToValue(1.0f).start(); + } + + /** + * On launcher stop, avoid animating taskbar & overriding pre-existing animations. + */ + public void onLauncherStop() { + mLauncherPauseProgress.cancelAnimation(); + mLauncherPauseProgress.updateValue(0.0f); + } + + private void onLauncherPauseProgressUpdate() { + // If we are not aligned with hotseat, setting this will clobber the 3 button nav position. + // So in that case, treat the progress as 0 instead. + float pauseProgress = isIconAlignedWithHotseat() ? mLauncherPauseProgress.value : 0; + onTaskbarInAppDisplayProgressUpdate(pauseProgress, LAUNCHER_PAUSE_PROGRESS_INDEX); + } + + } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index cc51adc260..5cb6e8643e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -801,6 +801,10 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, if (mLauncherUnfoldAnimationController != null) { mLauncherUnfoldAnimationController.onResume(); } + + if (mTaskbarUIController != null && FeatureFlags.enableHomeTransitionListener()) { + mTaskbarUIController.onLauncherResume(); + } } @Override @@ -821,6 +825,18 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, .playPlaceholderDismissAnim(this, LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED); } } + + if (mTaskbarUIController != null && FeatureFlags.enableHomeTransitionListener()) { + mTaskbarUIController.onLauncherPause(); + } + } + + @Override + protected void onStop() { + super.onStop(); + if (mTaskbarUIController != null && FeatureFlags.enableHomeTransitionListener()) { + mTaskbarUIController.onLauncherStop(); + } } @Override