[SB] Don't call SBWindowController#refreshSBHeight from PhoneSBView.
The `#refreshStatusBarHeight` call was added to address b/323299264,
but if I remove the call, I'm still unable to repro b/323299264. My
hunch is that b/323299264 was fixed by a revert in some other part of
the codebase, so the `#refreshStatusBarHeight` call is unnecessary.
But, I'm protecting the removal of that method call behind a flag so
that we can verify this hunch in stages before sending it to everyone.
Bug: 360115167
Flag: com.android.systemui.status_bar_stop_updating_window_height
Test: On unfolded, start in portrait, then rotate clockwise to 90deg,
then rotate clockwise to 270deg -> verify status bar does not get cut
off
Test: atest PhoneStatusBarViewTest
Change-Id: I85b2f4db944232e3fc5aeedbb8268ea41735af79
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig
index cdbac33..291db3c 100644
--- a/packages/SystemUI/aconfig/systemui.aconfig
+++ b/packages/SystemUI/aconfig/systemui.aconfig
@@ -387,6 +387,17 @@
}
flag {
+ name: "status_bar_stop_updating_window_height"
+ namespace: "systemui"
+ description: "Don't have PhoneStatusBarView manually trigger an update of the height in "
+ "StatusBarWindowController"
+ bug: "360115167"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
+flag {
name: "compose_bouncer"
namespace: "systemui"
description: "Use the new compose bouncer in SystemUI"
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 f7fded5..dda02db 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -321,6 +321,9 @@
}
private void updateWindowHeight() {
+ if (Flags.statusBarStopUpdatingWindowHeight()) {
+ return;
+ }
mStatusBarWindowController.refreshStatusBarHeight();
}
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 cbdf321..648ddf8 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
@@ -32,6 +32,7 @@
import android.view.WindowInsets
import android.widget.FrameLayout
import androidx.test.filters.SmallTest
+import com.android.systemui.Flags.FLAG_STATUS_BAR_STOP_UPDATING_WINDOW_HEIGHT
import com.android.systemui.Flags.FLAG_STATUS_BAR_SWIPE_OVER_CHIP
import com.android.systemui.Gefingerpoken
import com.android.systemui.SysuiTestCase
@@ -42,6 +43,7 @@
import com.google.common.truth.Truth.assertThat
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
@@ -176,21 +178,40 @@
}
@Test
- fun onAttachedToWindow_updatesWindowHeight() {
+ @DisableFlags(FLAG_STATUS_BAR_STOP_UPDATING_WINDOW_HEIGHT)
+ fun onAttachedToWindow_flagOff_updatesWindowHeight() {
view.onAttachedToWindow()
verify(windowController).refreshStatusBarHeight()
}
@Test
- fun onConfigurationChanged_updatesWindowHeight() {
+ @EnableFlags(FLAG_STATUS_BAR_STOP_UPDATING_WINDOW_HEIGHT)
+ fun onAttachedToWindow_flagOn_doesNotUpdateWindowHeight() {
+ view.onAttachedToWindow()
+
+ verify(windowController, never()).refreshStatusBarHeight()
+ }
+
+ @Test
+ @DisableFlags(FLAG_STATUS_BAR_STOP_UPDATING_WINDOW_HEIGHT)
+ fun onConfigurationChanged_flagOff_updatesWindowHeight() {
view.onConfigurationChanged(Configuration())
verify(windowController).refreshStatusBarHeight()
}
@Test
- fun onConfigurationChanged_multipleCalls_updatesWindowHeightMultipleTimes() {
+ @EnableFlags(FLAG_STATUS_BAR_STOP_UPDATING_WINDOW_HEIGHT)
+ fun onConfigurationChanged_flagOn_doesNotUpdateWindowHeight() {
+ view.onConfigurationChanged(Configuration())
+
+ verify(windowController, never()).refreshStatusBarHeight()
+ }
+
+ @Test
+ @DisableFlags(FLAG_STATUS_BAR_STOP_UPDATING_WINDOW_HEIGHT)
+ fun onConfigurationChanged_multipleCalls_flagOff_updatesWindowHeightMultipleTimes() {
view.onConfigurationChanged(Configuration())
view.onConfigurationChanged(Configuration())
view.onConfigurationChanged(Configuration())
@@ -200,6 +221,17 @@
}
@Test
+ @EnableFlags(FLAG_STATUS_BAR_STOP_UPDATING_WINDOW_HEIGHT)
+ fun onConfigurationChanged_multipleCalls_flagOn_neverUpdatesWindowHeight() {
+ 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)
view.setInsetsFetcher { insets }