Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/LargeTileSpanRepositoryTest.kt +1 −24 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ class LargeTileSpanRepositoryTest : SysuiTestCase() { private val Kosmos.underTest by Kosmos.Fixture { largeTileSpanRepository } @Test fun useExtraLargeTiles_tracksFontScale() = fun useExtraLargeTiles_tracksConfig() = kosmos.runTest { val latest by collectLastValue(underTest.useExtraLargeTiles) Loading @@ -65,29 +65,6 @@ class LargeTileSpanRepositoryTest : SysuiTestCase() { assertThat(latest).isTrue() } @Test fun useExtraLargeTiles_tracksScreenDensity() = kosmos.runTest { val latest by collectLastValue(underTest.useExtraLargeTiles) val configuration = Configuration().apply { this.densityDpi = 400 } context.orCreateTestableResources.overrideConfiguration(configuration) fakeConfigurationRepository.onConfigurationChange() assertThat(latest).isFalse() configuration.densityDpi = 470 fakeConfigurationRepository.onConfigurationChange() assertThat(latest).isFalse() configuration.densityDpi = 480 fakeConfigurationRepository.onConfigurationChange() assertThat(latest).isTrue() configuration.densityDpi = 600 fakeConfigurationRepository.onConfigurationChange() assertThat(latest).isTrue() } @Test fun tileMaxWidth_tracksConfig() = kosmos.runTest { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt +0 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.qs.panels.ui.viewmodel import android.content.res.Configuration import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase Loading Loading @@ -71,10 +70,6 @@ class QuickQuickSettingsViewModelTest : SysuiTestCase() { R.integer.quick_settings_infinite_grid_num_columns, 4, ) // Manually set the screen density to avoid triggering extra large tiles testCase.context.orCreateTestableResources.overrideConfiguration( Configuration().apply { this.densityDpi = 400 } ) fakeConfigurationRepository.onConfigurationChange() usingMediaInComposeFragment = true } Loading packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/LargeTileSpanRepository.kt +3 −7 Original line number Diff line number Diff line Loading @@ -50,18 +50,14 @@ constructor( val defaultTileMaxWidth: Int = DEFAULT_LARGE_TILE_WIDTH /** Use extra large tiles if the font scale or the screen density are past the thresholds. */ private val currentUseExtraLargeTiles: Boolean get() = resources.configuration.fontScale >= FONT_SCALE_THRESHOLD || resources.configuration.densityDpi >= DENSITY_THRESHOLD val currentUseExtraLargeTiles: Boolean get() = resources.configuration.fontScale >= FONT_SCALE_THRESHOLD private val currentTileMaxWidth: Int val currentTileMaxWidth: Int get() = resources.getInteger(R.integer.quick_settings_infinite_grid_tile_max_width) private companion object { const val FONT_SCALE_THRESHOLD = 1.8f const val DENSITY_THRESHOLD = 480 const val DEFAULT_LARGE_TILE_WIDTH = 2 } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/LargeTileSpanRepositoryTest.kt +1 −24 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ class LargeTileSpanRepositoryTest : SysuiTestCase() { private val Kosmos.underTest by Kosmos.Fixture { largeTileSpanRepository } @Test fun useExtraLargeTiles_tracksFontScale() = fun useExtraLargeTiles_tracksConfig() = kosmos.runTest { val latest by collectLastValue(underTest.useExtraLargeTiles) Loading @@ -65,29 +65,6 @@ class LargeTileSpanRepositoryTest : SysuiTestCase() { assertThat(latest).isTrue() } @Test fun useExtraLargeTiles_tracksScreenDensity() = kosmos.runTest { val latest by collectLastValue(underTest.useExtraLargeTiles) val configuration = Configuration().apply { this.densityDpi = 400 } context.orCreateTestableResources.overrideConfiguration(configuration) fakeConfigurationRepository.onConfigurationChange() assertThat(latest).isFalse() configuration.densityDpi = 470 fakeConfigurationRepository.onConfigurationChange() assertThat(latest).isFalse() configuration.densityDpi = 480 fakeConfigurationRepository.onConfigurationChange() assertThat(latest).isTrue() configuration.densityDpi = 600 fakeConfigurationRepository.onConfigurationChange() assertThat(latest).isTrue() } @Test fun tileMaxWidth_tracksConfig() = kosmos.runTest { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt +0 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.qs.panels.ui.viewmodel import android.content.res.Configuration import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase Loading Loading @@ -71,10 +70,6 @@ class QuickQuickSettingsViewModelTest : SysuiTestCase() { R.integer.quick_settings_infinite_grid_num_columns, 4, ) // Manually set the screen density to avoid triggering extra large tiles testCase.context.orCreateTestableResources.overrideConfiguration( Configuration().apply { this.densityDpi = 400 } ) fakeConfigurationRepository.onConfigurationChange() usingMediaInComposeFragment = true } Loading
packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/LargeTileSpanRepository.kt +3 −7 Original line number Diff line number Diff line Loading @@ -50,18 +50,14 @@ constructor( val defaultTileMaxWidth: Int = DEFAULT_LARGE_TILE_WIDTH /** Use extra large tiles if the font scale or the screen density are past the thresholds. */ private val currentUseExtraLargeTiles: Boolean get() = resources.configuration.fontScale >= FONT_SCALE_THRESHOLD || resources.configuration.densityDpi >= DENSITY_THRESHOLD val currentUseExtraLargeTiles: Boolean get() = resources.configuration.fontScale >= FONT_SCALE_THRESHOLD private val currentTileMaxWidth: Int val currentTileMaxWidth: Int get() = resources.getInteger(R.integer.quick_settings_infinite_grid_tile_max_width) private companion object { const val FONT_SCALE_THRESHOLD = 1.8f const val DENSITY_THRESHOLD = 480 const val DEFAULT_LARGE_TILE_WIDTH = 2 } }