Loading packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt +14 −0 Original line number Diff line number Diff line Loading @@ -21,11 +21,13 @@ 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.display.data.repository.displayStateRepository 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.data.repository.fakeShadeRepository import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading @@ -50,6 +52,18 @@ class ShadeModeInteractorImplTest : SysuiTestCase() { assertThat(shadeMode).isEqualTo(ShadeMode.Single) } @Test fun legacyShadeMode_narrowLargeScreen_singleShade() = kosmos.runTest { val shadeMode by collectLastValue(underTest.shadeMode) // This simulates the case of a tablet or certain unfolded foldables in portrait mode. enableSingleShade(wideLayout = false) fakeShadeRepository.setLargeScreen(true) displayStateRepository.setIsLargeScreen(true) assertThat(shadeMode).isEqualTo(ShadeMode.Single) } @Test fun legacyShadeMode_wideScreen_singleShade() = kosmos.runTest { Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt +17 −6 Original line number Diff line number Diff line Loading @@ -118,14 +118,25 @@ constructor( isShadeLayoutWide: Boolean, isLargeScreen: Boolean, ): ShadeMode { if (!SceneContainerFlag.isEnabled) { return if (isShadeLayoutWide) ShadeMode.Split else ShadeMode.Single } return when { // Case 1: Legacy shade (pre-scene container). !SceneContainerFlag.isEnabled -> if (isShadeLayoutWide) ShadeMode.Split else ShadeMode.Single // Case 2: The Dual Shade setting has been enabled by the user. isDualShadeEnabled -> ShadeMode.Dual isLargeScreen -> if (isSplitShadeEnabled) ShadeMode.Split else ShadeMode.Dual else -> ShadeMode.Single // Case 3: Phone in portrait orientation, with Dual Shade setting disabled. !isShadeLayoutWide -> ShadeMode.Single // Case 4: Phone in landscape orientation, with Dual Shade setting disabled. !isLargeScreen -> ShadeMode.Single // Case 5: Large screen with Split Shade enabled, Dual Shade setting disabled. isSplitShadeEnabled -> ShadeMode.Split // Case 6: Large screen with Split Shade disabled, Dual Shade setting disabled. else -> ShadeMode.Dual } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt +14 −0 Original line number Diff line number Diff line Loading @@ -21,11 +21,13 @@ 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.display.data.repository.displayStateRepository 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.data.repository.fakeShadeRepository import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading @@ -50,6 +52,18 @@ class ShadeModeInteractorImplTest : SysuiTestCase() { assertThat(shadeMode).isEqualTo(ShadeMode.Single) } @Test fun legacyShadeMode_narrowLargeScreen_singleShade() = kosmos.runTest { val shadeMode by collectLastValue(underTest.shadeMode) // This simulates the case of a tablet or certain unfolded foldables in portrait mode. enableSingleShade(wideLayout = false) fakeShadeRepository.setLargeScreen(true) displayStateRepository.setIsLargeScreen(true) assertThat(shadeMode).isEqualTo(ShadeMode.Single) } @Test fun legacyShadeMode_wideScreen_singleShade() = kosmos.runTest { Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt +17 −6 Original line number Diff line number Diff line Loading @@ -118,14 +118,25 @@ constructor( isShadeLayoutWide: Boolean, isLargeScreen: Boolean, ): ShadeMode { if (!SceneContainerFlag.isEnabled) { return if (isShadeLayoutWide) ShadeMode.Split else ShadeMode.Single } return when { // Case 1: Legacy shade (pre-scene container). !SceneContainerFlag.isEnabled -> if (isShadeLayoutWide) ShadeMode.Split else ShadeMode.Single // Case 2: The Dual Shade setting has been enabled by the user. isDualShadeEnabled -> ShadeMode.Dual isLargeScreen -> if (isSplitShadeEnabled) ShadeMode.Split else ShadeMode.Dual else -> ShadeMode.Single // Case 3: Phone in portrait orientation, with Dual Shade setting disabled. !isShadeLayoutWide -> ShadeMode.Single // Case 4: Phone in landscape orientation, with Dual Shade setting disabled. !isLargeScreen -> ShadeMode.Single // Case 5: Large screen with Split Shade enabled, Dual Shade setting disabled. isSplitShadeEnabled -> ShadeMode.Split // Case 6: Large screen with Split Shade disabled, Dual Shade setting disabled. else -> ShadeMode.Dual } } Loading