Desktop Mode Taskbar Recreate Animation

This Cl includes
       - addition of entry/exit callback methods in DesktopVisibilityController.
       - taskbar manager now listens to desktop mode changes.
       - TaskbarBackrgroundRedererer can now individually animation backgrounds for transient and persistent taskbars
       - new channel for taskbar icon alpha added to TaskbarViewController
       - new animated float to handle background alpha while we are recreating taskbar with animation.

Solution:

we use the callabck we get from DekstopVisibilty for entry/exit to first change logic of when we are considered inDesktopMode. Upon entry/exit we notify display controller for info change.
we also at notify taskbar manager who is now a listener to the desktop mode change and start the recreate process. TaskbarManager first animates existing taskbar out of user view and then follows the original recreate flow.

Test: Presubmit
Bug: 343882478
Flag: com.android.window.flags.enable_desktop_windowing_mode
Change-Id: Ib827564cacd194f499e7d9b1965e2bb13e3548ab
This commit is contained in:
Jagrut Desai committed 2025-02-24 11:59:53 -08:00
1 parent 332c329276
commit 8b2e5eff9b
19 files changed
+458 -86

No files matched your search

@@ -121,9 +121,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
public static final int ALPHA_INDEX_NOTIFICATION_EXPANDED = 4;
public static final int ALPHA_INDEX_ASSISTANT_INVOKED = 5;
public static final int ALPHA_INDEX_SMALL_SCREEN = 6;
public static final int ALPHA_INDEX_BUBBLE_BAR = 7;
private static final int NUM_ALPHA_CHANNELS = 8;
public static final int ALPHA_INDEX_RECREATE = 8;
private static final int NUM_ALPHA_CHANNELS = 9;
/** Only used for animation purposes, to position the divider between two item indices. */
public static final float DIVIDER_VIEW_POSITION_OFFSET = 0.5f;
@@ -238,9 +239,22 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
R.dimen.transient_taskbar_padding);
}
public void init(TaskbarControllers controllers) {
/**
* Init of taskbar view controller.
*/
public void init(TaskbarControllers controllers, AnimatorSet startAnimation) {
mControllers = controllers;
controllers.bubbleControllers.ifPresent(bc -> mBubbleControllers = bc);
if (startAnimation != null) {
MultiPropertyFactory<View>.MultiProperty multiProperty =
mTaskbarIconAlpha.get(ALPHA_INDEX_RECREATE);
multiProperty.setValue(0f);
Animator animator = multiProperty.animateToValue(1f);
animator.setInterpolator(EMPHASIZED);
startAnimation.play(animator);
}
mTaskbarView.init(TaskbarViewCallbacksFactory.newInstance(mActivity).create(
mActivity, mControllers, mTaskbarView));
mTaskbarView.getLayoutParams().height = mActivity.isPhoneMode()
@@ -362,6 +376,15 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
mTaskbarView.announceAccessibilityChanges();
}
/**
* Called with destroying Taskbar with animation.
*/
public void onDestroyAnimation(AnimatorSet animatorSet) {
animatorSet.play(
mTaskbarIconAlpha.get(TaskbarViewController.ALPHA_INDEX_RECREATE).animateToValue(
0f));
}
public void onDestroy() {
if (enableTaskbarPinning()) {
mTaskbarView.removeOnLayoutChangeListener(mTaskbarViewLayoutChangeListener);
@@ -1299,7 +1322,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
ObjectAnimator animator = mIconsTranslationXForNavbar.animateToValue(translationX);
animator.setStartDelay(FADE_OUT_ANIM_POSITION_DURATION_MS);
animator.setDuration(FADE_IN_ANIM_ALPHA_DURATION_MS);
animator.setInterpolator(Interpolators.EMPHASIZED);
animator.setInterpolator(EMPHASIZED);
return animator;
}
}