Merge "Pass bubble bar offsets instead of position to WMShell" into udc-qpr-dev

This commit is contained in:
Liran Binyamin
2023-07-12 14:41:32 +00:00
committed by Android (Google) Code Review
4 changed files with 31 additions and 8 deletions

View File

@@ -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();
}
}