Revert^2 "Synchronize bar expansion with WM Shell"

799802cb7e

Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 339683389
Test: atest BubbleBarViewAnimatorTest
Change-Id: Icd853eb76b20ee5ca035bd20c9360f5b60ecc00d
This commit is contained in:
Liran Binyamin committed 2024-08-15 10:35:36 +00:00
1 parent 799802cb7e
commit 02fdb75687
5 files changed
+158 -22

No files matched your search

@@ -495,6 +495,11 @@ public class BubbleBarController extends IBubblesListener.Stub {
() -> mBubbleBarViewController.animateBubbleBarLocation(bubbleBarLocation));
}
/** Notifies WMShell to show the expanded view. */
void showExpandedView() {
mSystemUiProxy.showExpandedView();
}
//
// Loading data for the bubbles
//
@@ -119,7 +119,8 @@ public class BubbleBarViewController {
mBubbleDragController = bubbleControllers.bubbleDragController;
mTaskbarStashController = controllers.taskbarStashController;
mTaskbarInsetsController = controllers.taskbarInsetsController;
mBubbleBarViewAnimator = new BubbleBarViewAnimator(mBarView, mBubbleStashController);
mBubbleBarViewAnimator = new BubbleBarViewAnimator(
mBarView, mBubbleStashController, mBubbleBarController::showExpandedView);
mTaskbarViewPropertiesProvider = taskbarViewPropertiesProvider;
onBubbleBarConfigurationChanged(/* animate= */ false);
mActivity.addOnDeviceProfileChangeListener(
@@ -36,6 +36,7 @@ class BubbleBarViewAnimator
constructor(
private val bubbleBarView: BubbleBarView,
private val bubbleStashController: BubbleStashController,
private val onExpanded: Runnable,
private val scheduler: Scheduler = HandlerScheduler(bubbleBarView)
) {
@@ -406,7 +407,7 @@ constructor(
springBackAnimation.spring(DynamicAnimation.TRANSLATION_Y, ty)
springBackAnimation.addEndListener { _, _, _, _, _, _, _ ->
if (animatingBubble?.expand == true) {
bubbleBarView.isExpanded = true
expandBubbleBar()
cancelHideAnimation()
} else {
moveToState(AnimatingBubble.State.IN)
@@ -417,7 +418,7 @@ constructor(
ObjectAnimator.ofFloat(bubbleBarView, View.TRANSLATION_Y, ty - bubbleBarBounceDistanceInPx)
.withDuration(BUBBLE_BAR_BOUNCE_ANIMATION_DURATION_MS)
.withEndAction {
if (animatingBubble?.expand == true) bubbleBarView.isExpanded = true
if (animatingBubble?.expand == true) expandBubbleBar()
springBackAnimation.start()
}
.start()
@@ -451,7 +452,7 @@ constructor(
this.animatingBubble = animatingBubble.copy(expand = true)
// if we're fully in and waiting to hide, cancel the hide animation and clean up
if (animatingBubble.state == AnimatingBubble.State.IN) {
bubbleBarView.isExpanded = true
expandBubbleBar()
cancelHideAnimation()
}
}
@@ -489,6 +490,11 @@ constructor(
this.animatingBubble = animatingBubble.copy(state = state)
}
private fun expandBubbleBar() {
bubbleBarView.isExpanded = true
onExpanded.run()
}
/**
* Tracks the translation Y of the bubble bar during the animation. When the bubble bar expands
* as part of the animation, the expansion should start after the bubble bar reaches the peak
@@ -510,7 +516,7 @@ constructor(
}
val expand = animatingBubble?.expand ?: false
if (reachedPeak && expand && !startedExpanding) {
bubbleBarView.isExpanded = true
expandBubbleBar()
startedExpanding = true
}
previousTy = ty
@@ -923,6 +923,17 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle, SafeCloseable {
}
}
/** Tells SysUI to show the expanded view. */
public void showExpandedView() {
try {
if (mBubbles != null) {
mBubbles.showExpandedView();
}
} catch (RemoteException e) {
Log.w(TAG, "Failed to call showExpandedView");
}
}
//
// Splitscreen
//