Loading packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/domain/interactor/WallpaperFocalAreaInteractorTest.kt +21 −5 Original line number Diff line number Diff line Loading @@ -51,8 +51,6 @@ import com.android.systemui.shade.domain.interactor.enableSingleShade import com.android.systemui.shade.domain.interactor.enableSplitShade import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.mock import com.android.systemui.wallpapers.data.repository.wallpaperFocalAreaRepository import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi Loading @@ -65,6 +63,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.spy import org.mockito.MockitoAnnotations import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.whenever Loading @@ -77,7 +76,7 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() { lateinit var shadeRepository: ShadeRepository private lateinit var mockedResources: Resources private lateinit var underTest: WallpaperFocalAreaInteractor private var wallpaperInteractor: WallpaperInteractor = spy(kosmos.wallpaperInteractor) private var wallpaperInteractor: WallpaperInteractor = spy(kosmos.wallpaperInteractorFaked) @Before fun setup() { Loading Loading @@ -113,7 +112,8 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() { backgroundScope = kosmos.backgroundScope, wallpaperInteractor = wallpaperInteractor, ) kosmos.wallpaperFocalAreaRepository.hasFocalArea.value = true kosmos.fakeWallpaperRepository.setShouldSendFocalArea(true) } @Test Loading Loading @@ -270,7 +270,7 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() { testScope.runTest { val shouldCollectFocalArea by collectLastValue(underTest.shouldCollectFocalArea) assertThat(shouldCollectFocalArea).isTrue() kosmos.wallpaperFocalAreaRepository.hasFocalArea.value = false kosmos.fakeWallpaperRepository.setShouldSendFocalArea(false) assertThat(shouldCollectFocalArea).isFalse() } Loading Loading @@ -445,6 +445,22 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() { assertThat(shouldCollectFocalArea).isFalse() } @Test fun lockscreenWallpaperNotHasFocalAreaTarget_hasFocalAreaIsTrue() = testScope.runTest { val hasFocalArea by collectLastValue(underTest.hasFocalArea) kosmos.fakeWallpaperRepository.setShouldSendFocalArea(true) assertThat(hasFocalArea).isTrue() } @Test fun lockscreenWallpaperHasFocalAreaTarget_hasFocalAreaIsFalse() = testScope.runTest { val hasFocalArea by collectLastValue(underTest.hasFocalArea) kosmos.fakeWallpaperRepository.setShouldSendFocalArea(false) assertThat(hasFocalArea).isFalse() } data class OverrideResources( val screenWidth: Int, val screenHeight: Int, Loading packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperFocalAreaRepository.kt +0 −3 Original line number Diff line number Diff line Loading @@ -22,9 +22,6 @@ import kotlinx.coroutines.flow.MutableStateFlow @SysUISingleton class WallpaperFocalAreaRepository @Inject constructor() { /** It will be true when wallpaper requires focal area info. */ val hasFocalArea = MutableStateFlow(true) /** The top of shortcut in screen, used by wallpaper to find remaining space in lockscreen */ val shortcutAbsoluteTop = MutableStateFlow(-1F) Loading packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperRepository.kt +0 −2 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart Loading Loading @@ -180,7 +179,6 @@ constructor( override val shouldSendFocalArea = lockscreenWallpaperInfo .filterNotNull() .map { val focalAreaTarget = context.resources.getString(SysUIR.string.focal_area_target) val shouldSendNotificationLayout = it?.component?.className == focalAreaTarget Loading packages/SystemUI/src/com/android/systemui/wallpapers/domain/interactor/WallpaperFocalAreaInteractor.kt +1 −2 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.emptyFlow Loading @@ -70,7 +69,7 @@ constructor( @Background private val backgroundScope: CoroutineScope, private val wallpaperInteractor: WallpaperInteractor, ) : CoreStartable { val hasFocalArea: StateFlow<Boolean> = wallpaperFocalAreaRepository.hasFocalArea val hasFocalArea = wallpaperInteractor.hasFocalArea @OptIn(ExperimentalCoroutinesApi::class) val shouldCollectFocalArea = Loading packages/SystemUI/src/com/android/systemui/wallpapers/domain/interactor/WallpaperInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ class WallpaperInteractor @Inject constructor(val wallpaperRepository: Wallpaper val wallpaperSupportsAmbientMode: Flow<Boolean> = wallpaperRepository.wallpaperSupportsAmbientMode val hasFocalArea = wallpaperRepository.shouldSendFocalArea fun sendWallpaperFocalAreaBounds(bounds: RectF) { wallpaperRepository.sendLockScreenLayoutChangeCommand(bounds) } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/domain/interactor/WallpaperFocalAreaInteractorTest.kt +21 −5 Original line number Diff line number Diff line Loading @@ -51,8 +51,6 @@ import com.android.systemui.shade.domain.interactor.enableSingleShade import com.android.systemui.shade.domain.interactor.enableSplitShade import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.mock import com.android.systemui.wallpapers.data.repository.wallpaperFocalAreaRepository import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi Loading @@ -65,6 +63,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.spy import org.mockito.MockitoAnnotations import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.whenever Loading @@ -77,7 +76,7 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() { lateinit var shadeRepository: ShadeRepository private lateinit var mockedResources: Resources private lateinit var underTest: WallpaperFocalAreaInteractor private var wallpaperInteractor: WallpaperInteractor = spy(kosmos.wallpaperInteractor) private var wallpaperInteractor: WallpaperInteractor = spy(kosmos.wallpaperInteractorFaked) @Before fun setup() { Loading Loading @@ -113,7 +112,8 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() { backgroundScope = kosmos.backgroundScope, wallpaperInteractor = wallpaperInteractor, ) kosmos.wallpaperFocalAreaRepository.hasFocalArea.value = true kosmos.fakeWallpaperRepository.setShouldSendFocalArea(true) } @Test Loading Loading @@ -270,7 +270,7 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() { testScope.runTest { val shouldCollectFocalArea by collectLastValue(underTest.shouldCollectFocalArea) assertThat(shouldCollectFocalArea).isTrue() kosmos.wallpaperFocalAreaRepository.hasFocalArea.value = false kosmos.fakeWallpaperRepository.setShouldSendFocalArea(false) assertThat(shouldCollectFocalArea).isFalse() } Loading Loading @@ -445,6 +445,22 @@ class WallpaperFocalAreaInteractorTest : SysuiTestCase() { assertThat(shouldCollectFocalArea).isFalse() } @Test fun lockscreenWallpaperNotHasFocalAreaTarget_hasFocalAreaIsTrue() = testScope.runTest { val hasFocalArea by collectLastValue(underTest.hasFocalArea) kosmos.fakeWallpaperRepository.setShouldSendFocalArea(true) assertThat(hasFocalArea).isTrue() } @Test fun lockscreenWallpaperHasFocalAreaTarget_hasFocalAreaIsFalse() = testScope.runTest { val hasFocalArea by collectLastValue(underTest.hasFocalArea) kosmos.fakeWallpaperRepository.setShouldSendFocalArea(false) assertThat(hasFocalArea).isFalse() } data class OverrideResources( val screenWidth: Int, val screenHeight: Int, Loading
packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperFocalAreaRepository.kt +0 −3 Original line number Diff line number Diff line Loading @@ -22,9 +22,6 @@ import kotlinx.coroutines.flow.MutableStateFlow @SysUISingleton class WallpaperFocalAreaRepository @Inject constructor() { /** It will be true when wallpaper requires focal area info. */ val hasFocalArea = MutableStateFlow(true) /** The top of shortcut in screen, used by wallpaper to find remaining space in lockscreen */ val shortcutAbsoluteTop = MutableStateFlow(-1F) Loading
packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperRepository.kt +0 −2 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart Loading Loading @@ -180,7 +179,6 @@ constructor( override val shouldSendFocalArea = lockscreenWallpaperInfo .filterNotNull() .map { val focalAreaTarget = context.resources.getString(SysUIR.string.focal_area_target) val shouldSendNotificationLayout = it?.component?.className == focalAreaTarget Loading
packages/SystemUI/src/com/android/systemui/wallpapers/domain/interactor/WallpaperFocalAreaInteractor.kt +1 −2 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.emptyFlow Loading @@ -70,7 +69,7 @@ constructor( @Background private val backgroundScope: CoroutineScope, private val wallpaperInteractor: WallpaperInteractor, ) : CoreStartable { val hasFocalArea: StateFlow<Boolean> = wallpaperFocalAreaRepository.hasFocalArea val hasFocalArea = wallpaperInteractor.hasFocalArea @OptIn(ExperimentalCoroutinesApi::class) val shouldCollectFocalArea = Loading
packages/SystemUI/src/com/android/systemui/wallpapers/domain/interactor/WallpaperInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ class WallpaperInteractor @Inject constructor(val wallpaperRepository: Wallpaper val wallpaperSupportsAmbientMode: Flow<Boolean> = wallpaperRepository.wallpaperSupportsAmbientMode val hasFocalArea = wallpaperRepository.shouldSendFocalArea fun sendWallpaperFocalAreaBounds(bounds: RectF) { wallpaperRepository.sendLockScreenLayoutChangeCommand(bounds) } Loading