diff options
| author | 2024-02-12 10:00:59 +0000 | |
|---|---|---|
| committer | 2024-02-12 12:41:50 +0000 | |
| commit | 23b32481f08b1fbb3044fdb8da788581a3b2c11a (patch) | |
| tree | d0d2a9a78144dd9236136a349c337a5924857eb9 | |
| parent | ee704763f3e99d01d3aacf0410416768bc1f057d (diff) | |
Always update status bar window height on config change events
This is the same behaviour as it was before in CentralSurfacesImpl.
Not always updating it was causing the window height not being updated
in certain config changes, and also causing some tests to fail in post
submit.
Bug: 324591580
Flag: ACONFIG com.android.systemui.truncated_status_bar_icons_fix DEVELOPMENT
Test: atest SystemUIGoogleScreenshotTests
Change-Id: I80dfbfee27a8f0b503adcce5a32d9e5c0f9c38ef
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java | 6 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt | 25 |
2 files changed, 28 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index 45bdae83bbd9..8ac3b4a75141 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -132,9 +132,9 @@ public class PhoneStatusBarView extends FrameLayout { if (updateDisplayParameters()) { updateLayoutForCutout(); requestLayout(); - if (truncatedStatusBarIconsFix()) { - updateWindowHeight(); - } + } + if (truncatedStatusBarIconsFix()) { + updateWindowHeight(); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt index 6eb1c1a9f12c..4293a27095c0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt @@ -42,6 +42,7 @@ import org.junit.Before import org.junit.Test import org.mockito.Mockito.never import org.mockito.Mockito.spy +import org.mockito.Mockito.times import org.mockito.Mockito.verify @SmallTest @@ -145,6 +146,18 @@ class PhoneStatusBarViewTest : SysuiTestCase() { } @Test + fun onConfigurationChanged_multipleCalls_flagEnabled_updatesWindowHeightMultipleTimes() { + mSetFlagsRule.enableFlags(Flags.FLAG_TRUNCATED_STATUS_BAR_ICONS_FIX) + + view.onConfigurationChanged(Configuration()) + view.onConfigurationChanged(Configuration()) + view.onConfigurationChanged(Configuration()) + view.onConfigurationChanged(Configuration()) + + verify(windowController, times(4)).refreshStatusBarHeight() + } + + @Test fun onConfigurationChanged_flagDisabled_doesNotUpdateWindowHeight() { mSetFlagsRule.disableFlags(Flags.FLAG_TRUNCATED_STATUS_BAR_ICONS_FIX) @@ -154,6 +167,18 @@ class PhoneStatusBarViewTest : SysuiTestCase() { } @Test + fun onConfigurationChanged_multipleCalls_flagDisabled_doesNotUpdateWindowHeight() { + mSetFlagsRule.disableFlags(Flags.FLAG_TRUNCATED_STATUS_BAR_ICONS_FIX) + + view.onConfigurationChanged(Configuration()) + view.onConfigurationChanged(Configuration()) + view.onConfigurationChanged(Configuration()) + view.onConfigurationChanged(Configuration()) + + verify(windowController, never()).refreshStatusBarHeight() + } + + @Test fun onAttachedToWindow_updatesLeftTopRightPaddingsBasedOnInsets() { val insets = Insets.of(/* left = */ 10, /* top = */ 20, /* right = */ 30, /* bottom = */ 40) whenever(contentInsetsProvider.getStatusBarContentInsetsForCurrentRotation()) |