diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 3046076ec3..2949a8042b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -25,7 +25,6 @@ import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITION import android.animation.Animator; import android.animation.AnimatorSet; -import android.annotation.ColorInt; import android.os.RemoteException; import android.util.Log; import android.view.TaskTransitionSpec; @@ -235,17 +234,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController { WindowManagerGlobal.getWindowManagerService().clearTaskTransitionSpec(); } else { // Adjust task transition spec to account for taskbar being visible - @ColorInt int taskAnimationBackgroundColor = - DisplayController.isTransientTaskbar(mLauncher) - ? mLauncher.getColor(R.color.transient_taskbar_background) - : mLauncher.getColor(R.color.taskbar_background); - - TaskTransitionSpec customTaskAnimationSpec = new TaskTransitionSpec( - taskAnimationBackgroundColor, - Set.of(ITYPE_EXTRA_NAVIGATION_BAR) - ); - WindowManagerGlobal.getWindowManagerService() - .setTaskTransitionSpec(customTaskAnimationSpec); + WindowManagerGlobal.getWindowManagerService().setTaskTransitionSpec( + new TaskTransitionSpec( + mLauncher.getColor(R.color.taskbar_background), + Set.of(ITYPE_EXTRA_NAVIGATION_BAR))); } } catch (RemoteException e) { // This shouldn't happen but if it does task animations won't look good until the diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 728c91f032..bafd5b4532 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -125,8 +125,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT private static final int FLAG_SMALL_SCREEN = 1 << 13; private static final int FLAG_SLIDE_IN_VIEW_VISIBLE = 1 << 14; - /** Flags where a UI could be over a slide in view, so the color override should be disabled. */ - private static final int FLAGS_SLIDE_IN_VIEW_ICON_COLOR_OVERRIDE_DISABLED = + /** + * Flags where a UI could be over Taskbar surfaces, so the color override should be disabled. + */ + private static final int FLAGS_ON_BACKGROUND_COLOR_OVERRIDE_DISABLED = FLAG_NOTIFICATION_SHADE_EXPANDED | FLAG_VOICE_INTERACTION_WINDOW_SHOWING; private static final String NAV_BUTTONS_SEPARATE_WINDOW_TITLE = "Taskbar Nav Buttons"; @@ -148,8 +150,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT private final ViewGroup mStartContextualContainer; private final int mLightIconColor; private final int mDarkIconColor; - /** Color to use for navigation bar buttons, if a slide in view is visible. */ - private final int mSlideInViewIconColor; + /** Color to use for navigation bar buttons, if they are on on a Taskbar surface background. */ + private final int mOnBackgroundIconColor; private final AnimatedFloat mTaskbarNavButtonTranslationY = new AnimatedFloat( this::updateNavButtonTranslationY); @@ -160,13 +162,18 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT // Used for System UI state updates that should translate the nav button for in-app display. private final AnimatedFloat mNavButtonInAppDisplayProgressForSysui = new AnimatedFloat( this::updateNavButtonInAppDisplayProgressForSysui); + /** Expected nav button dark intensity communicated via the framework. */ private final AnimatedFloat mTaskbarNavButtonDarkIntensity = new AnimatedFloat( - this::updateNavButtonDarkIntensity); - private final AnimatedFloat mNavButtonDarkIntensityMultiplier = new AnimatedFloat( - this::updateNavButtonDarkIntensity); - /** Overrides the navigation button color to {@code mSlideInViewIconColor} when {@code 1}. */ - private final AnimatedFloat mSlideInViewNavButtonColorOverride = new AnimatedFloat( - this::updateNavButtonDarkIntensity); + this::updateNavButtonColor); + /** {@code 1} if the Taskbar background color is fully opaque. */ + private final AnimatedFloat mOnTaskbarBackgroundNavButtonColorOverride = new AnimatedFloat( + this::updateNavButtonColor); + /** {@code 1} if a Taskbar slide in overlay is visible over Taskbar. */ + private final AnimatedFloat mSlideInViewVisibleNavButtonColorOverride = new AnimatedFloat( + this::updateNavButtonColor); + /** Disables the {@link #mOnBackgroundIconColor} override if {@code 0}. */ + private final AnimatedFloat mOnBackgroundNavButtonColorOverrideMultiplier = new AnimatedFloat( + this::updateNavButtonColor); private final RotationButtonListener mRotationButtonListener = new RotationButtonListener(); private final Rect mFloatingRotationButtonBounds = new Rect(); @@ -199,8 +206,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT mLightIconColor = context.getColor(R.color.taskbar_nav_icon_light_color); mDarkIconColor = context.getColor(R.color.taskbar_nav_icon_dark_color); - // Can precompute color since dark theme change recreates taskbar. - mSlideInViewIconColor = Utilities.isDarkTheme(context) ? mLightIconColor : mDarkIconColor; + mOnBackgroundIconColor = Utilities.isDarkTheme(context) ? mLightIconColor : mDarkIconColor; } /** @@ -266,10 +272,15 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT flags -> (flags & FLAG_IME_VISIBLE) != 0 && !isInKidsMode, AnimatedFloat.VALUE, transForIme, defaultButtonTransY)); + // Start at 1 because relevant flags are unset at init. + mOnBackgroundNavButtonColorOverrideMultiplier.value = 1; mPropertyHolders.add(new StatePropertyHolder( - mSlideInViewNavButtonColorOverride, - flags -> ((flags & FLAG_SLIDE_IN_VIEW_VISIBLE) != 0) - && ((flags & FLAGS_SLIDE_IN_VIEW_ICON_COLOR_OVERRIDE_DISABLED) == 0))); + mOnBackgroundNavButtonColorOverrideMultiplier, + flags -> (flags & FLAGS_ON_BACKGROUND_COLOR_OVERRIDE_DISABLED) == 0)); + + mPropertyHolders.add(new StatePropertyHolder( + mSlideInViewVisibleNavButtonColorOverride, + flags -> (flags & FLAG_SLIDE_IN_VIEW_VISIBLE) != 0)); if (alwaysShowButtons) { initButtons(mNavButtonContainer, mEndContextualContainer, @@ -569,9 +580,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT return mTaskbarNavButtonDarkIntensity; } - /** Use to determine whether to use the dark intensity requested by the underlying app */ - public AnimatedFloat getNavButtonDarkIntensityMultiplier() { - return mNavButtonDarkIntensityMultiplier; + /** Use to override the nav button color with {@link #mOnBackgroundIconColor}. */ + public AnimatedFloat getOnTaskbarBackgroundNavButtonColorOverride() { + return mOnTaskbarBackgroundNavButtonColorOverride; } /** @@ -617,14 +628,20 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT + inAppDisplayAdjustmentTranslationY); } - private void updateNavButtonDarkIntensity() { - float darkIntensity = mTaskbarNavButtonDarkIntensity.value - * mNavButtonDarkIntensityMultiplier.value; - ArgbEvaluator argbEvaluator = ArgbEvaluator.getInstance(); - int iconColor = (int) argbEvaluator.evaluate( - darkIntensity, mLightIconColor, mDarkIconColor); - iconColor = (int) argbEvaluator.evaluate( - mSlideInViewNavButtonColorOverride.value, iconColor, mSlideInViewIconColor); + private void updateNavButtonColor() { + final ArgbEvaluator argbEvaluator = ArgbEvaluator.getInstance(); + final int sysUiNavButtonIconColor = (int) argbEvaluator.evaluate( + mTaskbarNavButtonDarkIntensity.value, + mLightIconColor, + mDarkIconColor); + // Override the color from framework if nav buttons are over an opaque Taskbar surface. + final int iconColor = (int) argbEvaluator.evaluate( + mOnBackgroundNavButtonColorOverrideMultiplier.value + * Math.max( + mOnTaskbarBackgroundNavButtonColorOverride.value, + mSlideInViewVisibleNavButtonColorOverride.value), + sysUiNavButtonIconColor, + mOnBackgroundIconColor); for (ImageView button : mAllButtons) { button.setImageTintList(ColorStateList.valueOf(iconColor)); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt index 37d9090f24..78fae248ba 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt @@ -66,8 +66,6 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { paint.style = Paint.Style.FILL if (isTransientTaskbar) { - paint.color = context.getColor(R.color.transient_taskbar_background) - val res = context.resources bottomMargin = res.getDimensionPixelSize(R.dimen.transient_taskbar_margin) shadowBlur = res.getDimension(R.dimen.transient_taskbar_shadow_blur) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index 267bee1670..94c6af75fc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -59,10 +59,9 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa // Initialized in init. private TaskbarControllers mControllers; - private AnimatedFloat mNavButtonDarkIntensityMultiplier; + private AnimatedFloat mOnBackgroundNavButtonColorIntensity; private float mLastSetBackgroundAlpha; - private boolean mIsBackgroundDrawnElsewhere; public TaskbarDragLayerController(TaskbarActivityContext activity, TaskbarDragLayer taskbarDragLayer) { @@ -77,8 +76,8 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa mControllers = controllers; mTaskbarDragLayer.init(new TaskbarDragLayerCallbacks()); - mNavButtonDarkIntensityMultiplier = mControllers.navbarButtonsViewController - .getNavButtonDarkIntensityMultiplier(); + mOnBackgroundNavButtonColorIntensity = mControllers.navbarButtonsViewController + .getOnTaskbarBackgroundNavButtonColorOverride(); mBgTaskbar.value = 1; mKeyguardBgTaskbar.value = 1; @@ -156,7 +155,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa mLastSetBackgroundAlpha = mBgOverride.value * Math.max(bgNavbar, bgTaskbar); mTaskbarDragLayer.setTaskbarBackgroundAlpha(mLastSetBackgroundAlpha); - updateNavBarDarkIntensityMultiplier(); + updateOnBackgroundNavButtonColorIntensity(); } /** @@ -169,7 +168,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa private void updateBackgroundOffset() { mTaskbarDragLayer.setTaskbarBackgroundOffset(mBgOffset.value); - updateNavBarDarkIntensityMultiplier(); + updateOnBackgroundNavButtonColorIntensity(); } @Override @@ -178,23 +177,16 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa } /** - * 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. + * Set if another controller is temporarily handling background drawing. In this case we + * override our background alpha to be {@code 0}. */ public void setIsBackgroundDrawnElsewhere(boolean isBackgroundDrawnElsewhere) { - mIsBackgroundDrawnElsewhere = isBackgroundDrawnElsewhere; - mBgOverride.updateValue(mIsBackgroundDrawnElsewhere ? 0 : 1); - updateNavBarDarkIntensityMultiplier(); + mBgOverride.updateValue(isBackgroundDrawnElsewhere ? 0 : 1); } - 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); + private void updateOnBackgroundNavButtonColorIntensity() { + mOnBackgroundNavButtonColorIntensity.updateValue( + mLastSetBackgroundAlpha * (1 - mBgOffset.value)); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 0b275a85ce..3d5089fc07 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -142,9 +142,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar : R.drawable.ic_taskbar_all_apps_button)); mAllAppsButton.setScaleX(mIsRtl ? -1 : 1); mAllAppsButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding); - mAllAppsButton.setForegroundTint(mActivityContext.getColor(isTransientTaskbar - ? R.color.all_apps_button_color - : R.color.all_apps_button_color_dark)); + mAllAppsButton.setForegroundTint( + mActivityContext.getColor(R.color.all_apps_button_color)); if (FeatureFlags.ENABLE_TASKBAR_PINNING.get()) { mTaskbarDivider = LayoutInflater.from(context).inflate(R.layout.taskbar_divider, diff --git a/res/color-night-v31/transient_taskbar_background.xml b/res/color-night-v31/taskbar_background.xml similarity index 93% rename from res/color-night-v31/transient_taskbar_background.xml rename to res/color-night-v31/taskbar_background.xml index 40f6494933..8df168678c 100644 --- a/res/color-night-v31/transient_taskbar_background.xml +++ b/res/color-night-v31/taskbar_background.xml @@ -1,5 +1,5 @@ - - + diff --git a/res/color-v31/transient_taskbar_background.xml b/res/color-v31/transient_taskbar_background.xml deleted file mode 100644 index bce947da79..0000000000 --- a/res/color-v31/transient_taskbar_background.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/res/values-night-v31/colors.xml b/res/values-night-v31/colors.xml index 2c1bc90074..f331361f71 100644 --- a/res/values-night-v31/colors.xml +++ b/res/values-night-v31/colors.xml @@ -24,4 +24,6 @@ @android:color/system_neutral2_300 @android:color/system_accent2_700 @android:color/system_neutral1_700 + + @android:color/system_neutral2_200 \ No newline at end of file diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml index 4ba77fa055..17fe419a8c 100644 --- a/res/values-night/colors.xml +++ b/res/values-night/colors.xml @@ -17,5 +17,5 @@ --> - @color/all_apps_button_color_dark + #BFC8CC \ No newline at end of file diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml index f87d9fc13a..054fe47125 100644 --- a/res/values-v31/colors.xml +++ b/res/values-v31/colors.xml @@ -62,8 +62,7 @@ @android:color/system_accent1_300 @android:color/system_neutral2_700 - @android:color/system_neutral2_700 - @android:color/system_neutral2_200 + @android:color/system_neutral2_700 @android:color/system_accent2_100 diff --git a/res/values/colors.xml b/res/values/colors.xml index ef7bf91a11..9d6927b99a 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -80,9 +80,7 @@ #ff8df5e3 #ff3d665f - @color/all_apps_button_color_light - #40484B - #BFC8CC + #40484B #00668B #B5CAD7