Loading packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_deviceDoesNotSupport_false() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -252,6 +253,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_sysuiOverrideFalse_deviceDoesSupport_false() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -271,6 +273,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_sysuiOverrideTrue_deviceDoesSupport_true() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -290,6 +293,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_sysuiOverrideNull_deviceDoesSupport_true() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -309,6 +313,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_deviceDoesSupport_true() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -332,6 +337,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_deviceDoesSupport_settingDisabled_false() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 0) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -342,6 +348,22 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { assertThat(latest).isFalse() } @Test @EnableFlags(SharedFlags.FLAG_AMBIENT_AOD) fun wallpaperSupportsAmbientMode_deviceDoesSupport_userDisabledAod_false() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 0) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, false, ) configRepository.onAnyConfigurationChange() val latest by collectLastValue(underTest.wallpaperSupportsAmbientMode) assertThat(latest).isFalse() } @Test @EnableFlags(SharedFlags.FLAG_EXTENDED_WALLPAPER_EFFECTS) fun shouldSendNotificationLayout_setExtendedEffectsWallpaper() = Loading packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperRepository.kt +7 −3 Original line number Diff line number Diff line Loading @@ -128,13 +128,17 @@ constructor( Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, ) .onStart { emit(Unit) }, secureSettings .observerFlow(UserHandle.USER_ALL, Settings.Secure.DOZE_ALWAYS_ON) .onStart { emit(Unit) }, configurationInteractor.onAnyConfigurationChange, ::Pair, ::Triple, ) .map { val userEnabled = val aodEnabled = secureSettings.getInt(Settings.Secure.DOZE_ALWAYS_ON, 0) == 1 val wallpaperEnabled = secureSettings.getInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) == 1 userEnabled && configEnabled() && ambientAod() aodEnabled && wallpaperEnabled && configEnabled() && ambientAod() } .flowOn(bgDispatcher) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_deviceDoesNotSupport_false() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -252,6 +253,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_sysuiOverrideFalse_deviceDoesSupport_false() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -271,6 +273,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_sysuiOverrideTrue_deviceDoesSupport_true() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -290,6 +293,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_sysuiOverrideNull_deviceDoesSupport_true() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -309,6 +313,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_deviceDoesSupport_true() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -332,6 +337,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { fun wallpaperSupportsAmbientMode_deviceDoesSupport_settingDisabled_false() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 1) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 0) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, Loading @@ -342,6 +348,22 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { assertThat(latest).isFalse() } @Test @EnableFlags(SharedFlags.FLAG_AMBIENT_AOD) fun wallpaperSupportsAmbientMode_deviceDoesSupport_userDisabledAod_false() = testScope.runTest { underTest = kosmos.wallpaperRepository secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON, 0) secureSettings.putInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) context.orCreateTestableResources.addOverride( R.bool.config_dozeSupportsAodWallpaper, false, ) configRepository.onAnyConfigurationChange() val latest by collectLastValue(underTest.wallpaperSupportsAmbientMode) assertThat(latest).isFalse() } @Test @EnableFlags(SharedFlags.FLAG_EXTENDED_WALLPAPER_EFFECTS) fun shouldSendNotificationLayout_setExtendedEffectsWallpaper() = Loading
packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperRepository.kt +7 −3 Original line number Diff line number Diff line Loading @@ -128,13 +128,17 @@ constructor( Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, ) .onStart { emit(Unit) }, secureSettings .observerFlow(UserHandle.USER_ALL, Settings.Secure.DOZE_ALWAYS_ON) .onStart { emit(Unit) }, configurationInteractor.onAnyConfigurationChange, ::Pair, ::Triple, ) .map { val userEnabled = val aodEnabled = secureSettings.getInt(Settings.Secure.DOZE_ALWAYS_ON, 0) == 1 val wallpaperEnabled = secureSettings.getInt(Settings.Secure.DOZE_ALWAYS_ON_WALLPAPER_ENABLED, 1) == 1 userEnabled && configEnabled() && ambientAod() aodEnabled && wallpaperEnabled && configEnabled() && ambientAod() } .flowOn(bgDispatcher) Loading