diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 7e2b037a3c..6818db6ea5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -31,6 +31,8 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_Q import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; +import static java.lang.Math.abs; + import android.annotation.BinderThread; import android.annotation.Nullable; import android.app.Notification; @@ -341,8 +343,8 @@ public class BubbleBarController extends IBubblesListener.Stub { // TODO: (b/273316505) handle suppression } if (update.selectedBubbleKey != null) { - if (mSelectedBubble != null - && !update.selectedBubbleKey.equals(mSelectedBubble.getKey())) { + if (mSelectedBubble == null + || !update.selectedBubbleKey.equals(mSelectedBubble.getKey())) { BubbleBarBubble newlySelected = mBubbles.get(update.selectedBubbleKey); if (newlySelected != null) { bubbleToSelect = newlySelected; @@ -367,7 +369,6 @@ public class BubbleBarController extends IBubblesListener.Stub { /** Tells WMShell to show the currently selected bubble. */ public void showSelectedBubble() { if (getSelectedBubbleKey() != null) { - int[] bubbleBarCoords = mBarView.getLocationOnScreen(); if (mSelectedBubble instanceof BubbleBarBubble) { // Because we've visited this bubble, we should suppress the notification. // This is updated on WMShell side when we show the bubble, but that update isn't @@ -378,7 +379,7 @@ public class BubbleBarController extends IBubblesListener.Stub { mSelectedBubble.getView().updateDotVisibility(true /* animate */); } mSystemUiProxy.showBubble(getSelectedBubbleKey(), - bubbleBarCoords[0], bubbleBarCoords[1]); + getBubbleBarOffsetX(), getBubbleBarOffsetY()); } else { Log.w(TAG, "Trying to show the selected bubble but it's null"); } @@ -545,4 +546,13 @@ public class BubbleBarController extends IBubblesListener.Stub { return mIconFactory.createBadgedIconBitmap(drawable).icon; } + + private int getBubbleBarOffsetY() { + final int translation = (int) abs(mBubbleStashController.getBubbleBarTranslationY()); + return translation + mBarView.getHeight(); + } + + private int getBubbleBarOffsetX() { + return mBarView.getWidth() + mBarView.getHorizontalMargin(); + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index cf52a5e7e8..eec334afbd 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -223,6 +223,12 @@ public class BubbleBarView extends FrameLayout { setLayoutParams(lp); } + /** @return the horizontal margin between the bubble bar and the edge of the screen. */ + int getHorizontalMargin() { + LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams(); + return lp.getMarginEnd(); + } + /** * Updates the z order, positions, and badge visibility of the bubble views in the bar based * on the expanded state. diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java index 5177d932f1..c995b4c26e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java @@ -309,4 +309,9 @@ public class BubbleStashController { return -hotseatBottomSpace - hotseatCellHeight + mUnstashedHeight - abs( hotseatCellHeight - mUnstashedHeight) / 2; } + + float getBubbleBarTranslationY() { + return mBubblesShowingOnHome ? getBubbleBarTranslationYForHotseat() + : getBubbleBarTranslationYForTaskbar(); + } } diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index d2e7fb54f3..60784f5854 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -646,13 +646,15 @@ public class SystemUiProxy implements ISystemUiProxy { /** * Tells SysUI to show the bubble with the provided key. * @param key the key of the bubble to show. - * @param bubbleBarXCoordinate the X coordinate of the bubble bar on the screen. - * @param bubbleBarYCoordinate the Y coordinate of the bubble bar on the screen. + * @param bubbleBarOffsetX the offset of the bubble bar from the edge of the screen on the X + * axis. + * @param bubbleBarOffsetY the offset of the bubble bar from the edge of the screen on the Y + * axis. */ - public void showBubble(String key, int bubbleBarXCoordinate, int bubbleBarYCoordinate) { + public void showBubble(String key, int bubbleBarOffsetX, int bubbleBarOffsetY) { if (mBubbles != null) { try { - mBubbles.showBubble(key, bubbleBarXCoordinate, bubbleBarYCoordinate); + mBubbles.showBubble(key, bubbleBarOffsetX, bubbleBarOffsetY); } catch (RemoteException e) { Log.w(TAG, "Failed call showBubble"); }