fix(non linear font scaling): clock and battery textview might be cut off in status bar when large font scaling
Originally system icons in status bar have fixed top and bottom 8dp paddings, when larger font scaling the space might not enough for enlarged textview then the percentage textview is cut off, as in b/291168760. Therefore, as a quick solution we let the status_bar system_icons layout height be a sp dimen value like combined_qs_header and set the top/bottom paddings in system_icons to 0dp. It's to ensure the system_icons layout height is larger than the status icons height. In the future cl, we would also ensure the status bar height should be enough for accommodating the system_icons.
Bug: 291168760
Test: manually - attached screenshot in bug
Change-Id: I070bf6d5faa858acfa4927a9590c4575dc91f2fe
diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml
index 0ab921f..5132e57 100644
--- a/packages/SystemUI/res/layout/status_bar.xml
+++ b/packages/SystemUI/res/layout/status_bar.xml
@@ -67,6 +67,7 @@
android:id="@+id/status_bar_start_side_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical|start"
android:clipChildren="false">
<include layout="@layout/heads_up_status_bar_layout" />
@@ -88,7 +89,8 @@
<com.android.systemui.statusbar.policy.Clock
android:id="@+id/clock"
android:layout_width="wrap_content"
- android:layout_height="match_parent"
+ android:layout_height="@dimen/status_bar_system_icons_height"
+ android:layout_gravity="center_vertical"
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
android:singleLine="true"
android:paddingStart="@dimen/status_bar_left_clock_starting_padding"
@@ -146,7 +148,10 @@
android:layout_marginEnd="@dimen/status_bar_user_chip_end_margin"
layout="@layout/status_bar_user_chip_container" />
- <include layout="@layout/system_icons" />
+ <include layout="@layout/system_icons"
+ android:layout_gravity="center_vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/status_bar_system_icons_height" />
</com.android.keyguard.AlphaOptimizedLinearLayout>
</FrameLayout>
</LinearLayout>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index de8287e..3d4e8cd 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -121,6 +121,9 @@
<dimen name="navigation_edge_cancelled_arrow_height">0dp</dimen>
<dimen name="navigation_edge_cancelled_edge_corners">6dp</dimen>
+ <!-- Height of the system icons container view in the status bar -->
+ <dimen name="status_bar_system_icons_height">@dimen/status_bar_icon_size_sp</dimen>
+
<!-- New sp height of notification icons in the status bar -->
<dimen name="status_bar_icon_size_sp">@*android:dimen/status_bar_icon_size_sp</dimen>
<!-- Original dp height of notification icons in the status bar -->
@@ -343,8 +346,8 @@
<dimen name="status_bar_icons_padding_start">11dp</dimen>
<dimen name="status_bar_icons_padding_end">0dp</dimen>
- <dimen name="status_bar_icons_padding_bottom">8dp</dimen>
- <dimen name="status_bar_icons_padding_top">8dp</dimen>
+ <dimen name="status_bar_icons_padding_bottom">0dp</dimen>
+ <dimen name="status_bar_icons_padding_top">0dp</dimen>
<!-- gap on either side of status bar notification icons -->
<dimen name="status_bar_icon_horizontal_margin">0sp</dimen>