Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelTest.kt +3 −2 Original line number Diff line number Diff line Loading @@ -56,11 +56,12 @@ class CommunalUserActionsViewModelTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() private lateinit var underTest: CommunalUserActionsViewModel private val underTest: CommunalUserActionsViewModel by lazy { kosmos.communalUserActionsViewModel } @Before fun setUp() { underTest = kosmos.communalUserActionsViewModel underTest.activateIn(kosmos.testScope) } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt +33 −0 Original line number Diff line number Diff line Loading @@ -16,13 +16,16 @@ package com.android.systemui.shade.domain.interactor import android.content.testableContext import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.res.R import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -57,6 +60,36 @@ class ShadeModeInteractorImplTest : SysuiTestCase() { assertThat(shadeMode).isEqualTo(ShadeMode.Split) } @Test fun legacyShadeMode_disableSplitShade_wideScreen_dualShade() = kosmos.runTest { enableSplitShade() testableContext.orCreateTestableResources.addOverride( R.bool.config_disableSplitShade, true, ) fakeConfigurationRepository.onAnyConfigurationChange() val shadeMode by collectLastValue(underTest.shadeMode) assertThat(shadeMode).isEqualTo(ShadeMode.Dual) } @Test fun legacyShadeMode_disableSplitShade_narrowScreen_singleShade() = kosmos.runTest { val shadeMode by collectLastValue(underTest.shadeMode) enableSingleShade() testableContext.orCreateTestableResources.addOverride( R.bool.config_disableSplitShade, true, ) fakeConfigurationRepository.onAnyConfigurationChange() assertThat(shadeMode).isEqualTo(ShadeMode.Single) } @Test fun shadeMode_wideScreen_isDual() = kosmos.runTest { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java +5 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import android.os.Looper; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.testing.TestableLooper.RunWithLooper; import android.util.DisplayMetrics; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -341,10 +342,11 @@ public class NotificationContentInflaterTest extends SysuiTestCase { @Test @Ignore public void testNotificationViewHeightTooSmallFailsValidation() { DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics(); View view = mock(View.class); when(view.getHeight()) .thenReturn((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 10, mContext.getResources().getDisplayMetrics())); displayMetrics)); String result = NotificationContentInflater.isValidView(view, mEntry, mContext.getResources()); assertNotNull(result); Loading @@ -352,10 +354,11 @@ public class NotificationContentInflaterTest extends SysuiTestCase { @Test public void testNotificationViewPassesValidation() { DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics(); View view = mock(View.class); when(view.getHeight()) .thenReturn((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 17, mContext.getResources().getDisplayMetrics())); displayMetrics)); String result = NotificationContentInflater.isValidView(view, mEntry, mContext.getResources()); assertNull(result); Loading packages/SystemUI/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -689,6 +689,10 @@ <!-- TODO(b/411449027): This config is deprecated. Remove with the launch of SceneContainer. --> <bool name="force_config_use_split_notification_shade">false</bool> <!-- Whether to disable split shade on this configuration, and use dual shade instead. --> <!-- TODO(b/411449027): Remove this config once it is true on all configurations. --> <bool name="config_disableSplitShade">false</bool> <!-- Whether we use large screen shade header which takes only one row compared to QS header --> <bool name="config_use_large_screen_shade_header">false</bool> Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt +11 −5 Original line number Diff line number Diff line Loading @@ -16,13 +16,15 @@ package com.android.systemui.shade.domain.interactor import android.content.Context import android.provider.Settings import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.log.table.logDiffsForTable import com.android.systemui.res.R import com.android.systemui.scene.domain.SceneFrameworkTableLog import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.shade.data.repository.ShadeRepository import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.shared.settings.data.repository.SecureSettingsRepository Loading Loading @@ -73,8 +75,9 @@ interface ShadeModeInteractor { class ShadeModeInteractorImpl @Inject constructor( @Application applicationScope: CoroutineScope, @Background applicationScope: CoroutineScope, @Background backgroundDispatcher: CoroutineDispatcher, @ShadeDisplayAware private val context: Context, private val repository: ShadeRepository, secureSettingsRepository: SecureSettingsRepository, @SceneFrameworkTableLog private val tableLogBuffer: TableLogBuffer, Loading Loading @@ -109,9 +112,12 @@ constructor( ): ShadeMode { return when { isDualShadeEnabled -> ShadeMode.Dual // TODO(b/376411622): Once Dual Shade is enabled by default in SceneContainer, replace // Split below with Dual. This will effectively remove Split mode from SceneContainer. isShadeLayoutWide -> ShadeMode.Split isShadeLayoutWide -> if (context.resources.getBoolean(R.bool.config_disableSplitShade)) { ShadeMode.Dual } else { ShadeMode.Split } else -> ShadeMode.Single } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelTest.kt +3 −2 Original line number Diff line number Diff line Loading @@ -56,11 +56,12 @@ class CommunalUserActionsViewModelTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() private lateinit var underTest: CommunalUserActionsViewModel private val underTest: CommunalUserActionsViewModel by lazy { kosmos.communalUserActionsViewModel } @Before fun setUp() { underTest = kosmos.communalUserActionsViewModel underTest.activateIn(kosmos.testScope) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt +33 −0 Original line number Diff line number Diff line Loading @@ -16,13 +16,16 @@ package com.android.systemui.shade.domain.interactor import android.content.testableContext import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.res.R import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -57,6 +60,36 @@ class ShadeModeInteractorImplTest : SysuiTestCase() { assertThat(shadeMode).isEqualTo(ShadeMode.Split) } @Test fun legacyShadeMode_disableSplitShade_wideScreen_dualShade() = kosmos.runTest { enableSplitShade() testableContext.orCreateTestableResources.addOverride( R.bool.config_disableSplitShade, true, ) fakeConfigurationRepository.onAnyConfigurationChange() val shadeMode by collectLastValue(underTest.shadeMode) assertThat(shadeMode).isEqualTo(ShadeMode.Dual) } @Test fun legacyShadeMode_disableSplitShade_narrowScreen_singleShade() = kosmos.runTest { val shadeMode by collectLastValue(underTest.shadeMode) enableSingleShade() testableContext.orCreateTestableResources.addOverride( R.bool.config_disableSplitShade, true, ) fakeConfigurationRepository.onAnyConfigurationChange() assertThat(shadeMode).isEqualTo(ShadeMode.Single) } @Test fun shadeMode_wideScreen_isDual() = kosmos.runTest { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java +5 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import android.os.Looper; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.testing.TestableLooper.RunWithLooper; import android.util.DisplayMetrics; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -341,10 +342,11 @@ public class NotificationContentInflaterTest extends SysuiTestCase { @Test @Ignore public void testNotificationViewHeightTooSmallFailsValidation() { DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics(); View view = mock(View.class); when(view.getHeight()) .thenReturn((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 10, mContext.getResources().getDisplayMetrics())); displayMetrics)); String result = NotificationContentInflater.isValidView(view, mEntry, mContext.getResources()); assertNotNull(result); Loading @@ -352,10 +354,11 @@ public class NotificationContentInflaterTest extends SysuiTestCase { @Test public void testNotificationViewPassesValidation() { DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics(); View view = mock(View.class); when(view.getHeight()) .thenReturn((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 17, mContext.getResources().getDisplayMetrics())); displayMetrics)); String result = NotificationContentInflater.isValidView(view, mEntry, mContext.getResources()); assertNull(result); Loading
packages/SystemUI/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -689,6 +689,10 @@ <!-- TODO(b/411449027): This config is deprecated. Remove with the launch of SceneContainer. --> <bool name="force_config_use_split_notification_shade">false</bool> <!-- Whether to disable split shade on this configuration, and use dual shade instead. --> <!-- TODO(b/411449027): Remove this config once it is true on all configurations. --> <bool name="config_disableSplitShade">false</bool> <!-- Whether we use large screen shade header which takes only one row compared to QS header --> <bool name="config_use_large_screen_shade_header">false</bool> Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt +11 −5 Original line number Diff line number Diff line Loading @@ -16,13 +16,15 @@ package com.android.systemui.shade.domain.interactor import android.content.Context import android.provider.Settings import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.log.table.logDiffsForTable import com.android.systemui.res.R import com.android.systemui.scene.domain.SceneFrameworkTableLog import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.shade.data.repository.ShadeRepository import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.shared.settings.data.repository.SecureSettingsRepository Loading Loading @@ -73,8 +75,9 @@ interface ShadeModeInteractor { class ShadeModeInteractorImpl @Inject constructor( @Application applicationScope: CoroutineScope, @Background applicationScope: CoroutineScope, @Background backgroundDispatcher: CoroutineDispatcher, @ShadeDisplayAware private val context: Context, private val repository: ShadeRepository, secureSettingsRepository: SecureSettingsRepository, @SceneFrameworkTableLog private val tableLogBuffer: TableLogBuffer, Loading Loading @@ -109,9 +112,12 @@ constructor( ): ShadeMode { return when { isDualShadeEnabled -> ShadeMode.Dual // TODO(b/376411622): Once Dual Shade is enabled by default in SceneContainer, replace // Split below with Dual. This will effectively remove Split mode from SceneContainer. isShadeLayoutWide -> ShadeMode.Split isShadeLayoutWide -> if (context.resources.getBoolean(R.bool.config_disableSplitShade)) { ShadeMode.Dual } else { ShadeMode.Split } else -> ShadeMode.Single } } Loading