Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SplitShadeNotificationStackScrollLayoutSection.kt +6 −1 Original line number Original line Diff line number Diff line Loading @@ -87,8 +87,13 @@ constructor( ) ) setGoneMargin(R.id.nssl_placeholder, TOP, bottomMargin) setGoneMargin(R.id.nssl_placeholder, TOP, bottomMargin) } else { } else { connect(R.id.nssl_placeholder, TOP, R.id.keyguard_status_view, TOP, bottomMargin) val splitShadeTopMargin = context.resources.getDimensionPixelSize( R.dimen.large_screen_shade_header_height ) connect(R.id.nssl_placeholder, TOP, PARENT_ID, TOP, splitShadeTopMargin) } } connect(R.id.nssl_placeholder, START, PARENT_ID, START) connect(R.id.nssl_placeholder, START, PARENT_ID, START) connect(R.id.nssl_placeholder, END, PARENT_ID, END) connect(R.id.nssl_placeholder, END, PARENT_ID, END) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt +3 −0 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,8 @@ constructor( marginTop = getDimensionPixelSize(R.dimen.notification_panel_margin_top), marginTop = getDimensionPixelSize(R.dimen.notification_panel_margin_top), marginTopLargeScreen = marginTopLargeScreen = getDimensionPixelSize(R.dimen.large_screen_shade_header_height), getDimensionPixelSize(R.dimen.large_screen_shade_header_height), keyguardSplitShadeTopMargin = getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin), ) ) } } } } Loading Loading @@ -95,5 +97,6 @@ constructor( val marginBottom: Int, val marginBottom: Int, val marginTop: Int, val marginTop: Int, val marginTopLargeScreen: Int, val marginTopLargeScreen: Int, val keyguardSplitShadeTopMargin: Int, ) ) } } packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +10 −5 Original line number Original line Diff line number Diff line Loading @@ -83,6 +83,14 @@ constructor( marginTop = marginTop = if (it.useLargeScreenHeader) it.marginTopLargeScreen else it.marginTop, if (it.useLargeScreenHeader) it.marginTopLargeScreen else it.marginTop, useSplitShade = it.useSplitShade, useSplitShade = it.useSplitShade, paddingTop = if (it.useSplitShade) { // When in split shade, the margin is applied twice as the legacy shade // code uses it to calculate padding. it.keyguardSplitShadeTopMargin - 2 * it.marginTopLargeScreen } else { 0 } ) ) } } .distinctUntilChanged() .distinctUntilChanged() Loading Loading @@ -156,11 +164,7 @@ constructor( ), ), ) { onLockscreen, bounds, config, (top, isInTransitionToAnyState, qsExpansion) -> ) { onLockscreen, bounds, config, (top, isInTransitionToAnyState, qsExpansion) -> if (onLockscreen) { if (onLockscreen) { if (config.useSplitShade) { bounds.copy(top = bounds.top + config.paddingTop) bounds.copy(top = 0f) } else { bounds } } else { } else { // When QS expansion > 0, it should directly set the top padding so do not // When QS expansion > 0, it should directly set the top padding so do not // animate it // animate it Loading Loading @@ -268,5 +272,6 @@ constructor( val marginEnd: Int, val marginEnd: Int, val marginBottom: Int, val marginBottom: Int, val useSplitShade: Boolean, val useSplitShade: Boolean, val paddingTop: Int, ) ) } } packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt +3 −1 Original line number Original line Diff line number Diff line Loading @@ -19,10 +19,10 @@ package com.android.systemui.statusbar.notification.stack.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.systemui.res.R import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.data.repository.FakeConfigurationRepository import com.android.systemui.common.ui.data.repository.FakeConfigurationRepository import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectLastValue import com.android.systemui.res.R import com.android.systemui.statusbar.policy.ResourcesSplitShadeStateController import com.android.systemui.statusbar.policy.ResourcesSplitShadeStateController import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runCurrent Loading Loading @@ -56,6 +56,7 @@ class SharedNotificationContainerInteractorTest : SysuiTestCase() { overrideResource(R.dimen.notification_panel_margin_bottom, 10) overrideResource(R.dimen.notification_panel_margin_bottom, 10) overrideResource(R.dimen.notification_panel_margin_top, 10) overrideResource(R.dimen.notification_panel_margin_top, 10) overrideResource(R.dimen.large_screen_shade_header_height, 0) overrideResource(R.dimen.large_screen_shade_header_height, 0) overrideResource(R.dimen.keyguard_split_shade_top_margin, 55) val dimens = collectLastValue(underTest.configurationBasedDimensions) val dimens = collectLastValue(underTest.configurationBasedDimensions) Loading @@ -70,5 +71,6 @@ class SharedNotificationContainerInteractorTest : SysuiTestCase() { assertThat(lastDimens.marginBottom).isGreaterThan(0) assertThat(lastDimens.marginBottom).isGreaterThan(0) assertThat(lastDimens.marginTop).isGreaterThan(0) assertThat(lastDimens.marginTop).isGreaterThan(0) assertThat(lastDimens.marginTopLargeScreen).isEqualTo(0) assertThat(lastDimens.marginTopLargeScreen).isEqualTo(0) assertThat(lastDimens.keyguardSplitShadeTopMargin).isEqualTo(55) } } } } packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +38 −7 Original line number Original line Diff line number Diff line Loading @@ -99,6 +99,34 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { assertThat(dimens!!.marginStart).isEqualTo(20) assertThat(dimens!!.marginStart).isEqualTo(20) } } @Test fun validatePaddingTopInSplitShade() = testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, true) overrideResource(R.dimen.large_screen_shade_header_height, 10) overrideResource(R.dimen.keyguard_split_shade_top_margin, 50) val dimens by collectLastValue(underTest.configurationBasedDimensions) configurationRepository.onAnyConfigurationChange() assertThat(dimens!!.paddingTop).isEqualTo(30) } @Test fun validatePaddingTop() = testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, false) overrideResource(R.dimen.large_screen_shade_header_height, 10) overrideResource(R.dimen.keyguard_split_shade_top_margin, 50) val dimens by collectLastValue(underTest.configurationBasedDimensions) configurationRepository.onAnyConfigurationChange() assertThat(dimens!!.paddingTop).isEqualTo(0) } @Test @Test fun validateMarginEnd() = fun validateMarginEnd() = testScope.runTest { testScope.runTest { Loading Loading @@ -226,9 +254,9 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { } } @Test @Test fun positionOnLockscreenNotInSplitShade() = fun boundsOnLockscreenNotInSplitShade() = testScope.runTest { testScope.runTest { val position by collectLastValue(underTest.bounds) val bounds by collectLastValue(underTest.bounds) // When not in split shade // When not in split shade overrideResource(R.bool.config_use_split_notification_shade, false) overrideResource(R.bool.config_use_split_notification_shade, false) Loading @@ -242,16 +270,19 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { NotificationContainerBounds(top = 1f, bottom = 2f) NotificationContainerBounds(top = 1f, bottom = 2f) ) ) assertThat(position).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) } } @Test @Test fun positionOnLockscreenInSplitShade() = fun boundsOnLockscreenInSplitShade() = testScope.runTest { testScope.runTest { val position by collectLastValue(underTest.bounds) val bounds by collectLastValue(underTest.bounds) // When in split shade // When in split shade overrideResource(R.bool.config_use_split_notification_shade, true) overrideResource(R.bool.config_use_split_notification_shade, true) overrideResource(R.dimen.large_screen_shade_header_height, 10) overrideResource(R.dimen.keyguard_split_shade_top_margin, 50) configurationRepository.onAnyConfigurationChange() configurationRepository.onAnyConfigurationChange() runCurrent() runCurrent() Loading @@ -263,8 +294,8 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { ) ) runCurrent() runCurrent() // Top should be overridden to 0f // Top should be equal to bounds (1) + padding adjustment (30) assertThat(position).isEqualTo(NotificationContainerBounds(top = 0f, bottom = 2f)) assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 31f, bottom = 2f)) } } @Test @Test Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SplitShadeNotificationStackScrollLayoutSection.kt +6 −1 Original line number Original line Diff line number Diff line Loading @@ -87,8 +87,13 @@ constructor( ) ) setGoneMargin(R.id.nssl_placeholder, TOP, bottomMargin) setGoneMargin(R.id.nssl_placeholder, TOP, bottomMargin) } else { } else { connect(R.id.nssl_placeholder, TOP, R.id.keyguard_status_view, TOP, bottomMargin) val splitShadeTopMargin = context.resources.getDimensionPixelSize( R.dimen.large_screen_shade_header_height ) connect(R.id.nssl_placeholder, TOP, PARENT_ID, TOP, splitShadeTopMargin) } } connect(R.id.nssl_placeholder, START, PARENT_ID, START) connect(R.id.nssl_placeholder, START, PARENT_ID, START) connect(R.id.nssl_placeholder, END, PARENT_ID, END) connect(R.id.nssl_placeholder, END, PARENT_ID, END) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt +3 −0 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,8 @@ constructor( marginTop = getDimensionPixelSize(R.dimen.notification_panel_margin_top), marginTop = getDimensionPixelSize(R.dimen.notification_panel_margin_top), marginTopLargeScreen = marginTopLargeScreen = getDimensionPixelSize(R.dimen.large_screen_shade_header_height), getDimensionPixelSize(R.dimen.large_screen_shade_header_height), keyguardSplitShadeTopMargin = getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin), ) ) } } } } Loading Loading @@ -95,5 +97,6 @@ constructor( val marginBottom: Int, val marginBottom: Int, val marginTop: Int, val marginTop: Int, val marginTopLargeScreen: Int, val marginTopLargeScreen: Int, val keyguardSplitShadeTopMargin: Int, ) ) } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +10 −5 Original line number Original line Diff line number Diff line Loading @@ -83,6 +83,14 @@ constructor( marginTop = marginTop = if (it.useLargeScreenHeader) it.marginTopLargeScreen else it.marginTop, if (it.useLargeScreenHeader) it.marginTopLargeScreen else it.marginTop, useSplitShade = it.useSplitShade, useSplitShade = it.useSplitShade, paddingTop = if (it.useSplitShade) { // When in split shade, the margin is applied twice as the legacy shade // code uses it to calculate padding. it.keyguardSplitShadeTopMargin - 2 * it.marginTopLargeScreen } else { 0 } ) ) } } .distinctUntilChanged() .distinctUntilChanged() Loading Loading @@ -156,11 +164,7 @@ constructor( ), ), ) { onLockscreen, bounds, config, (top, isInTransitionToAnyState, qsExpansion) -> ) { onLockscreen, bounds, config, (top, isInTransitionToAnyState, qsExpansion) -> if (onLockscreen) { if (onLockscreen) { if (config.useSplitShade) { bounds.copy(top = bounds.top + config.paddingTop) bounds.copy(top = 0f) } else { bounds } } else { } else { // When QS expansion > 0, it should directly set the top padding so do not // When QS expansion > 0, it should directly set the top padding so do not // animate it // animate it Loading Loading @@ -268,5 +272,6 @@ constructor( val marginEnd: Int, val marginEnd: Int, val marginBottom: Int, val marginBottom: Int, val useSplitShade: Boolean, val useSplitShade: Boolean, val paddingTop: Int, ) ) } }
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt +3 −1 Original line number Original line Diff line number Diff line Loading @@ -19,10 +19,10 @@ package com.android.systemui.statusbar.notification.stack.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.systemui.res.R import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.data.repository.FakeConfigurationRepository import com.android.systemui.common.ui.data.repository.FakeConfigurationRepository import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectLastValue import com.android.systemui.res.R import com.android.systemui.statusbar.policy.ResourcesSplitShadeStateController import com.android.systemui.statusbar.policy.ResourcesSplitShadeStateController import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runCurrent Loading Loading @@ -56,6 +56,7 @@ class SharedNotificationContainerInteractorTest : SysuiTestCase() { overrideResource(R.dimen.notification_panel_margin_bottom, 10) overrideResource(R.dimen.notification_panel_margin_bottom, 10) overrideResource(R.dimen.notification_panel_margin_top, 10) overrideResource(R.dimen.notification_panel_margin_top, 10) overrideResource(R.dimen.large_screen_shade_header_height, 0) overrideResource(R.dimen.large_screen_shade_header_height, 0) overrideResource(R.dimen.keyguard_split_shade_top_margin, 55) val dimens = collectLastValue(underTest.configurationBasedDimensions) val dimens = collectLastValue(underTest.configurationBasedDimensions) Loading @@ -70,5 +71,6 @@ class SharedNotificationContainerInteractorTest : SysuiTestCase() { assertThat(lastDimens.marginBottom).isGreaterThan(0) assertThat(lastDimens.marginBottom).isGreaterThan(0) assertThat(lastDimens.marginTop).isGreaterThan(0) assertThat(lastDimens.marginTop).isGreaterThan(0) assertThat(lastDimens.marginTopLargeScreen).isEqualTo(0) assertThat(lastDimens.marginTopLargeScreen).isEqualTo(0) assertThat(lastDimens.keyguardSplitShadeTopMargin).isEqualTo(55) } } } }
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +38 −7 Original line number Original line Diff line number Diff line Loading @@ -99,6 +99,34 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { assertThat(dimens!!.marginStart).isEqualTo(20) assertThat(dimens!!.marginStart).isEqualTo(20) } } @Test fun validatePaddingTopInSplitShade() = testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, true) overrideResource(R.dimen.large_screen_shade_header_height, 10) overrideResource(R.dimen.keyguard_split_shade_top_margin, 50) val dimens by collectLastValue(underTest.configurationBasedDimensions) configurationRepository.onAnyConfigurationChange() assertThat(dimens!!.paddingTop).isEqualTo(30) } @Test fun validatePaddingTop() = testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, false) overrideResource(R.dimen.large_screen_shade_header_height, 10) overrideResource(R.dimen.keyguard_split_shade_top_margin, 50) val dimens by collectLastValue(underTest.configurationBasedDimensions) configurationRepository.onAnyConfigurationChange() assertThat(dimens!!.paddingTop).isEqualTo(0) } @Test @Test fun validateMarginEnd() = fun validateMarginEnd() = testScope.runTest { testScope.runTest { Loading Loading @@ -226,9 +254,9 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { } } @Test @Test fun positionOnLockscreenNotInSplitShade() = fun boundsOnLockscreenNotInSplitShade() = testScope.runTest { testScope.runTest { val position by collectLastValue(underTest.bounds) val bounds by collectLastValue(underTest.bounds) // When not in split shade // When not in split shade overrideResource(R.bool.config_use_split_notification_shade, false) overrideResource(R.bool.config_use_split_notification_shade, false) Loading @@ -242,16 +270,19 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { NotificationContainerBounds(top = 1f, bottom = 2f) NotificationContainerBounds(top = 1f, bottom = 2f) ) ) assertThat(position).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) } } @Test @Test fun positionOnLockscreenInSplitShade() = fun boundsOnLockscreenInSplitShade() = testScope.runTest { testScope.runTest { val position by collectLastValue(underTest.bounds) val bounds by collectLastValue(underTest.bounds) // When in split shade // When in split shade overrideResource(R.bool.config_use_split_notification_shade, true) overrideResource(R.bool.config_use_split_notification_shade, true) overrideResource(R.dimen.large_screen_shade_header_height, 10) overrideResource(R.dimen.keyguard_split_shade_top_margin, 50) configurationRepository.onAnyConfigurationChange() configurationRepository.onAnyConfigurationChange() runCurrent() runCurrent() Loading @@ -263,8 +294,8 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { ) ) runCurrent() runCurrent() // Top should be overridden to 0f // Top should be equal to bounds (1) + padding adjustment (30) assertThat(position).isEqualTo(NotificationContainerBounds(top = 0f, bottom = 2f)) assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 31f, bottom = 2f)) } } @Test @Test Loading