Update bubble bar location in shell

Send wmshell updates about bubble bar position when it is dragged
across the center divide.

Bug: 330585397
Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT
Test: manual
  - with bubble bar on home screen
      - long press and drag bubble bar around on same side, no drop
        target
      - release the bubble bar, it snaps back to the original position
      - long press and drag bubble bar to other side, see drop target at
        the corner
      - release bubble bar, it snaps to the new side
      - long press and drag bubble bar to other side and back, see the
        drop target visible, release, snaps back to the original
        position
  - repeat above steps from an app, swipe up taskbar for bubble bar
Change-Id: I88faf641b9c07a19cfbb7a1feb8170a64269ac1f
This commit is contained in:
Ats Jenk
2024-03-29 09:53:59 -07:00
parent 1bc33421de
commit 2ae49c6cab
4 changed files with 137 additions and 21 deletions

View File

@@ -220,7 +220,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
mBubbleStashedHandleViewController.setHiddenForBubbles(
!sBubbleBarEnabled || mBubbles.isEmpty());
mBubbleBarViewController.setUpdateSelectedBubbleAfterCollapse(
key -> setSelectedBubble(mBubbles.get(key)));
key -> setSelectedBubbleInternal(mBubbles.get(key)));
});
}
@@ -390,7 +390,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
}
}
if (bubbleToSelect != null) {
setSelectedBubble(bubbleToSelect);
setSelectedBubbleInternal(bubbleToSelect);
if (previouslySelectedBubble == null) {
mBubbleStashController.animateToInitialState(update.expanded);
}
@@ -409,8 +409,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
if (update.bubbleBarLocation != mBubbleBarViewController.getBubbleBarLocation()) {
// Animate when receiving updates. Skip it if we received the initial state.
boolean animate = !update.initialState;
mBubbleBarViewController.setBubbleBarLocation(update.bubbleBarLocation, animate);
mBubbleStashController.setBubbleBarLocation(update.bubbleBarLocation);
updateBubbleBarLocationInternal(update.bubbleBarLocation, animate);
}
}
}
@@ -436,7 +435,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
/** Updates the currently selected bubble for launcher views and tells WMShell to show it. */
public void showAndSelectBubble(BubbleBarItem b) {
if (DEBUG) Log.w(TAG, "showingSelectedBubble: " + b.getKey());
setSelectedBubble(b);
setSelectedBubbleInternal(b);
showSelectedBubble();
}
@@ -445,7 +444,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
* WMShell that the selection has changed, that should go through either
* {@link #showSelectedBubble()} or {@link #showAndSelectBubble(BubbleBarItem)}.
*/
private void setSelectedBubble(BubbleBarItem b) {
private void setSelectedBubbleInternal(BubbleBarItem b) {
if (!Objects.equals(b, mSelectedBubble)) {
if (DEBUG) Log.w(TAG, "selectingBubble: " + b.getKey());
mSelectedBubble = b;
@@ -464,6 +463,21 @@ public class BubbleBarController extends IBubblesListener.Stub {
return null;
}
/**
* Set a new bubble bar location.
* <p>
* Updates the value locally in Launcher and in WMShell.
*/
public void updateBubbleBarLocation(BubbleBarLocation location) {
updateBubbleBarLocationInternal(location, false /* animate */);
mSystemUiProxy.setBubbleBarLocation(location);
}
private void updateBubbleBarLocationInternal(BubbleBarLocation location, boolean animate) {
mBubbleBarViewController.setBubbleBarLocation(location, animate);
mBubbleStashController.setBubbleBarLocation(location);
}
//
// Loading data for the bubbles
//