Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73fee7f7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Only enable ambient wallpaper if AOD is also enabled" into main

parents 3b8a186b 8a06307a
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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() =
+7 −3
Original line number Diff line number Diff line
@@ -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)