Reland "Fix the gap between notification and smartspace is too large in large screen portrait mode"
Flag: com.android.systemui.migrate_clocks_to_blueprint
Bug: 351778047
Bug: 349955447
Test: presubmit SharedNotificationContainerViewModelTest
Change-Id: I16264454c01421f03dd1f00c498101d60566351e
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt
index f14c96ded..71cd95f 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt
@@ -64,7 +64,6 @@
import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor
import com.android.systemui.testKosmos
import com.android.systemui.util.mockito.any
-import com.android.systemui.util.mockito.whenever
import com.google.common.collect.Range
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -77,6 +76,7 @@
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.mock
+import org.mockito.kotlin.whenever
import platform.test.runner.parameterized.ParameterizedAndroidJunit4
import platform.test.runner.parameterized.Parameters
@@ -213,9 +213,11 @@
}
@Test
- fun validatePaddingTop() =
+ fun validatePaddingTopInNonSplitShade_usesLargeScreenHeader() =
testScope.runTest {
+ whenever(largeScreenHeaderHelper.getLargeScreenHeaderHeight()).thenReturn(10)
overrideResource(R.bool.config_use_split_notification_shade, false)
+ overrideResource(R.bool.config_use_large_screen_shade_header, true)
overrideResource(R.dimen.large_screen_shade_header_height, 10)
overrideResource(R.dimen.keyguard_split_shade_top_margin, 50)
@@ -223,6 +225,21 @@
configurationRepository.onAnyConfigurationChange()
+ assertThat(paddingTop).isEqualTo(10)
+ }
+
+ @Test
+ fun validatePaddingTopInNonSplitShade_doesNotUseLargeScreenHeader() =
+ testScope.runTest {
+ whenever(largeScreenHeaderHelper.getLargeScreenHeaderHeight()).thenReturn(10)
+ overrideResource(R.bool.config_use_split_notification_shade, false)
+ overrideResource(R.bool.config_use_large_screen_shade_header, false)
+ overrideResource(R.dimen.large_screen_shade_header_height, 10)
+ overrideResource(R.dimen.keyguard_split_shade_top_margin, 50)
+
+ val paddingTop by collectLastValue(underTest.paddingTopDimen)
+
+ configurationRepository.onAnyConfigurationChange()
assertThat(paddingTop).isEqualTo(0)
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
index d1d5d30..99f7a75 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
@@ -187,7 +187,6 @@
interactor.configurationBasedDimensions
.map {
when {
- !it.useSplitShade -> 0
it.useLargeScreenHeader -> it.marginTopLargeScreen
else -> it.marginTop
}