summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java7
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java16
2 files changed, 16 insertions, 7 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
index 58b46d202599..f6a2c8d9695e 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
@@ -595,7 +595,10 @@ public class BubbleController implements ConfigurationChangeListener,
* <p>If bubble bar is supported, bubble views will be updated to switch to bar mode.
*/
public void registerBubbleStateListener(Bubbles.BubbleStateListener listener) {
- if (Flags.enableBubbleBar() && mBubblePositioner.isLargeScreen() && listener != null) {
+ final boolean bubbleBarAllowed = Flags.enableBubbleBar()
+ && (mBubblePositioner.isLargeScreen() || Flags.enableBubbleBarOnPhones())
+ && listener != null;
+ if (bubbleBarAllowed) {
// Only set the listener if we can show the bubble bar.
mBubbleStateListener = listener;
setUpBubbleViewsForMode();
@@ -772,7 +775,7 @@ public class BubbleController implements ConfigurationChangeListener,
/** Whether bubbles would be shown with the bubble bar UI. */
public boolean isShowingAsBubbleBar() {
return Flags.enableBubbleBar()
- && mBubblePositioner.isLargeScreen()
+ && (mBubblePositioner.isLargeScreen() || Flags.enableBubbleBarOnPhones())
&& mBubbleStateListener != null;
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java
index 5273a7cf2432..221c9332711e 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java
@@ -32,6 +32,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.internal.protolog.ProtoLog;
import com.android.launcher3.icons.IconNormalizer;
+import com.android.wm.shell.Flags;
import com.android.wm.shell.R;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider;
@@ -906,7 +907,7 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
if (isOverflow) {
return mOverflowHeight;
} else {
- return getBubbleBarExpandedViewHeightForLandscape();
+ return getBubbleBarExpandedViewHeight();
}
}
@@ -927,18 +928,23 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
* | bottom inset ↕ | ↓
* |----------------------| --- mScreenRect.bottom
*/
- private int getBubbleBarExpandedViewHeightForLandscape() {
+ private int getBubbleBarExpandedViewHeight() {
int heightOfBubbleBarContainer =
mScreenRect.height() - getExpandedViewBottomForBubbleBar();
- // getting landscape height from screen rect
- int expandedViewHeight = Math.min(mScreenRect.width(), mScreenRect.height());
+ int expandedViewHeight;
+ if (Flags.enableBubbleBarOnPhones() && !mDeviceConfig.isLargeScreen()) {
+ // we're on a phone, use the max / height
+ expandedViewHeight = Math.max(mScreenRect.width(), mScreenRect.height());
+ } else {
+ // getting landscape height from screen rect
+ expandedViewHeight = Math.min(mScreenRect.width(), mScreenRect.height());
+ }
expandedViewHeight -= heightOfBubbleBarContainer; /* removing bubble container height */
expandedViewHeight -= mInsets.top; /* removing top inset */
expandedViewHeight -= mExpandedViewPadding; /* removing spacing */
return expandedViewHeight;
}
-
/** The bottom position of the expanded view when showing above the bubble bar. */
public int getExpandedViewBottomForBubbleBar() {
return mBubbleBarTopOnScreen - mExpandedViewPadding;