Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/layout/StatusBarContentInsetsProviderTest.kt +21 −0 Original line number Diff line number Diff line Loading @@ -720,6 +720,27 @@ class StatusBarContentInsetsProviderTest : SysuiTestCase() { assertThat(bounds.top).isEqualTo(expectedTopInset) } @Test fun calculateInsetsForRotationWithRotatedResources_bottomAlignedMargin_noCutout_topIsZero() { val bounds = calculateInsetsForRotationWithRotatedResources( currentRotation = ROTATION_NONE, targetRotation = ROTATION_NONE, sysUICutout = null, maxBounds = Rect(0, 0, 1080, 2160), statusBarHeight = 100, minLeft = 0, minRight = 0, isRtl = false, dotWidth = 10, bottomAlignedMargin = 5, statusBarContentHeight = 15, ) // Bottom aligned margin should only be take into account for displays with a cutout. assertThat(bounds.top).isEqualTo(0) } @Test fun testCalculateInsetsForRotationWithRotatedResources_nonCornerCutout() { // GIVEN phone in portrait mode, where width < height and the cutout is not in the corner Loading packages/SystemUI/src/com/android/systemui/statusbar/layout/StatusBarContentInsetsProvider.kt +5 −2 Original line number Diff line number Diff line Loading @@ -573,7 +573,7 @@ private fun getStatusBarContentBounds( bottomAlignedMargin: Int, statusBarContentHeight: Int, ): Rect { val insetTop = getInsetTop(bottomAlignedMargin, statusBarContentHeight, sbHeight) val insetTop = getInsetTop(bottomAlignedMargin, statusBarContentHeight, sbHeight, sysUICutout) val logicalDisplayWidth = if (targetRotation.isHorizontal()) height else width Loading Loading @@ -666,8 +666,11 @@ private fun getInsetTop( bottomAlignedMargin: Int, statusBarContentHeight: Int, statusBarHeight: Int, sysUICutout: SysUICutoutInformation?, ): Int { val bottomAlignmentEnabled = bottomAlignedMargin >= 0 // This bottom aligned margin is only intended for displays with a cutout, so that the // content can be aligned with the cutout, when it isn't centered. val bottomAlignmentEnabled = bottomAlignedMargin >= 0 && sysUICutout != null if (!bottomAlignmentEnabled) { return 0 } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/layout/StatusBarContentInsetsProviderTest.kt +21 −0 Original line number Diff line number Diff line Loading @@ -720,6 +720,27 @@ class StatusBarContentInsetsProviderTest : SysuiTestCase() { assertThat(bounds.top).isEqualTo(expectedTopInset) } @Test fun calculateInsetsForRotationWithRotatedResources_bottomAlignedMargin_noCutout_topIsZero() { val bounds = calculateInsetsForRotationWithRotatedResources( currentRotation = ROTATION_NONE, targetRotation = ROTATION_NONE, sysUICutout = null, maxBounds = Rect(0, 0, 1080, 2160), statusBarHeight = 100, minLeft = 0, minRight = 0, isRtl = false, dotWidth = 10, bottomAlignedMargin = 5, statusBarContentHeight = 15, ) // Bottom aligned margin should only be take into account for displays with a cutout. assertThat(bounds.top).isEqualTo(0) } @Test fun testCalculateInsetsForRotationWithRotatedResources_nonCornerCutout() { // GIVEN phone in portrait mode, where width < height and the cutout is not in the corner Loading
packages/SystemUI/src/com/android/systemui/statusbar/layout/StatusBarContentInsetsProvider.kt +5 −2 Original line number Diff line number Diff line Loading @@ -573,7 +573,7 @@ private fun getStatusBarContentBounds( bottomAlignedMargin: Int, statusBarContentHeight: Int, ): Rect { val insetTop = getInsetTop(bottomAlignedMargin, statusBarContentHeight, sbHeight) val insetTop = getInsetTop(bottomAlignedMargin, statusBarContentHeight, sbHeight, sysUICutout) val logicalDisplayWidth = if (targetRotation.isHorizontal()) height else width Loading Loading @@ -666,8 +666,11 @@ private fun getInsetTop( bottomAlignedMargin: Int, statusBarContentHeight: Int, statusBarHeight: Int, sysUICutout: SysUICutoutInformation?, ): Int { val bottomAlignmentEnabled = bottomAlignedMargin >= 0 // This bottom aligned margin is only intended for displays with a cutout, so that the // content can be aligned with the cutout, when it isn't centered. val bottomAlignmentEnabled = bottomAlignedMargin >= 0 && sysUICutout != null if (!bottomAlignmentEnabled) { return 0 } Loading