From b9ecff07e455fe9d2cd0c610880b90dfc16202dc Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 25 Jan 2023 19:00:53 +0000 Subject: [PATCH] Fix TaskbarBackgroundRenderer not being applied correctly in 2 cases - Rename isInAppAndNotStashed to areTaskbarIconsVisibleAndNotStashing, and check taskbarViewController.areIconsVisible() accordingly. This effectively handles the same as before, but also handles Overview, which is not inApp but does have areIconsVisible() - This fixes bubble scrim over overview taskbar, as well as showing taskbar background behind assistant in 3 button mode. - Also fix nav bar button dark density changing when applying the separate background for assistant Test: Open bubble and invoke assistant in overview, over IME, inside an app, over home Fixes: 266715337 Change-Id: Ie655de7abd1634e2165543d57664d7c7e054a986 --- .../taskbar/TaskbarDragLayerController.java | 15 +++++++++++++++ .../taskbar/TaskbarScrimViewController.java | 3 ++- .../launcher3/taskbar/TaskbarStashController.java | 6 +++--- .../taskbar/TaskbarTranslationController.java | 2 +- .../taskbar/VoiceInteractionWindowController.kt | 11 +++-------- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index cd27a46a00..1f3eac09df 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -60,6 +60,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa private AnimatedFloat mNavButtonDarkIntensityMultiplier; private float mLastSetBackgroundAlpha; + private boolean mIsBackgroundDrawnElsewhere; public TaskbarDragLayerController(TaskbarActivityContext activity, TaskbarDragLayer taskbarDragLayer) { @@ -168,9 +169,23 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa mTaskbarDragLayer.setCornerRoundness(cornerRoundness); } + /** + * Set if another controller is temporarily handling background drawing. In this case we: + * - Override our background alpha to be 0. + * - Keep the nav bar dark intensity assuming taskbar background is at full alpha. + */ + public void setIsBackgroundDrawnElsewhere(boolean isBackgroundDrawnElsewhere) { + mIsBackgroundDrawnElsewhere = isBackgroundDrawnElsewhere; + mBgOverride.updateValue(mIsBackgroundDrawnElsewhere ? 0 : 1); + updateNavBarDarkIntensityMultiplier(); + } + private void updateNavBarDarkIntensityMultiplier() { // Zero out the app-requested dark intensity when we're drawing our own background. float effectiveBgAlpha = mLastSetBackgroundAlpha * (1 - mBgOffset.value); + if (mIsBackgroundDrawnElsewhere) { + effectiveBgAlpha = 1; + } mNavButtonDarkIntensityMultiplier.updateValue(1 - effectiveBgAlpha); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java index 88767dd61d..5ea00cf408 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java @@ -67,7 +67,8 @@ public class TaskbarScrimViewController implements TaskbarControllers.LoggableTa final boolean manageMenuExpanded = (stateFlags & SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0; final boolean showScrim = !mControllers.navbarButtonsViewController.isImeVisible() - && bubblesExpanded && mControllers.taskbarStashController.isInAppAndNotStashed(); + && bubblesExpanded + && mControllers.taskbarStashController.isTaskbarVisibleAndNotStashing(); final float scrimAlpha = manageMenuExpanded // When manage menu shows there's the first scrim and second scrim so figure out // what the total transparency would be. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index ef79b8ef77..2bd2ea5bdd 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -349,10 +349,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba /** - * Returns whether the taskbar is currently visible and in an app. + * Returns whether the taskbar is currently visible and not in the process of being stashed. */ - public boolean isInAppAndNotStashed() { - return !mIsStashed && isInApp(); + public boolean isTaskbarVisibleAndNotStashing() { + return !mIsStashed && mControllers.taskbarViewController.areIconsVisible(); } public boolean isInApp() { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java index 586115d4f2..80f030fb69 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java @@ -113,7 +113,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable return; } reset(); - if (mControllers.taskbarStashController.isInAppAndNotStashed()) { + if (mControllers.taskbarStashController.isTaskbarVisibleAndNotStashing()) { mControllers.taskbarEduTooltipController.maybeShowFeaturesEdu(); } })); diff --git a/quickstep/src/com/android/launcher3/taskbar/VoiceInteractionWindowController.kt b/quickstep/src/com/android/launcher3/taskbar/VoiceInteractionWindowController.kt index be34fb160b..7b5773afe4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/VoiceInteractionWindowController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/VoiceInteractionWindowController.kt @@ -34,10 +34,7 @@ class VoiceInteractionWindowController(val context: TaskbarActivityContext) : override fun draw(canvas: Canvas) { super.draw(canvas) - if ( - this@VoiceInteractionWindowController.context.isGestureNav && - controllers.taskbarStashController.isInAppAndNotStashed - ) { + if (controllers.taskbarStashController.isTaskbarVisibleAndNotStashing) { taskbarBackgroundRenderer.draw(canvas) } } @@ -92,8 +89,6 @@ class VoiceInteractionWindowController(val context: TaskbarActivityContext) : * Removes the temporary window and show the TaskbarDragLayer background again. */ private fun moveTaskbarBackgroundToAppropriateLayer(skipAnim: Boolean) { - val taskbarBackgroundOverride = - controllers.taskbarDragLayerController.overrideBackgroundAlpha val moveToLowerLayer = isVoiceInteractionWindowVisible val onWindowsSynchronized = if (moveToLowerLayer) { @@ -102,10 +97,10 @@ class VoiceInteractionWindowController(val context: TaskbarActivityContext) : separateWindowForTaskbarBackground, separateWindowLayoutParams ); - { taskbarBackgroundOverride.updateValue(0f) } + { controllers.taskbarDragLayerController.setIsBackgroundDrawnElsewhere(true) } } else { // First reapply the original taskbar background, then remove the temporary window. - taskbarBackgroundOverride.updateValue(1f); + controllers.taskbarDragLayerController.setIsBackgroundDrawnElsewhere(false); { context.removeWindowView(separateWindowForTaskbarBackground) } }