diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java
index 3f7696fa8c349..f98fbfc5c77a1 100644
--- a/core/java/com/android/internal/widget/FloatingToolbar.java
+++ b/core/java/com/android/internal/widget/FloatingToolbar.java
@@ -1247,9 +1247,13 @@ public final class FloatingToolbar {
}
private static int getAdjustedToolbarWidth(Context context, int width) {
- if (width <= 0 || width > getScreenWidth(context)) {
- width = context.getResources()
- .getDimensionPixelSize(R.dimen.floating_toolbar_default_width);
+ int maximumWidth = getScreenWidth(context) - 2 * context.getResources()
+ .getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
+
+ if (width <= 0 || width > maximumWidth) {
+ int defaultWidth = context.getResources()
+ .getDimensionPixelSize(R.dimen.floating_toolbar_preferred_width);
+ width = Math.min(defaultWidth, maximumWidth);
}
return width;
}
diff --git a/core/res/res/values-land/dimens.xml b/core/res/res/values-land/dimens.xml
index 640ca1ef97e27..4f0c0fbc48356 100644
--- a/core/res/res/values-land/dimens.xml
+++ b/core/res/res/values-land/dimens.xml
@@ -67,4 +67,7 @@
380dp
+
+ 544dp
+
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index bbba712c81a12..84747f13cbb4c 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -391,7 +391,7 @@
18dp
14sp
48dp
- 264dp
+ 328dp
144dp
16dp
8dp
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 801a98a679d0e..11583b3201087 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2241,7 +2241,7 @@
-
+