Loading packages/SystemUI/multivalentTests/src/com/android/systemui/ambientcue/domain/interactor/AmbientCueInteractorTest.kt +16 −0 Original line number Diff line number Diff line Loading @@ -73,4 +73,20 @@ class AmbientCueInteractorTest : SysuiTestCase() { ambientCueRepository.fake.setActions(testActions) assertThat(actions).isEqualTo(testActions) } @Test fun isImeVisible_setTrue_true() = kosmos.runTest { val isImeVisible by collectLastValue(ambientCueInteractor.isImeVisible) ambientCueInteractor.setIsImeVisible(true) assertThat(isImeVisible).isTrue() } @Test fun isImeVisible_setFalse_false() = kosmos.runTest { val isImeVisible by collectLastValue(ambientCueInteractor.isImeVisible) ambientCueInteractor.setIsImeVisible(false) assertThat(isImeVisible).isFalse() } } packages/SystemUI/src/com/android/systemui/ambientcue/data/repository/AmbientCueRepository.kt +5 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,9 @@ interface AmbientCueRepository { /** If hint (or chips list) should be visible. */ val isVisible: MutableStateFlow<Boolean> /** If IME is visible or not. */ val isImeVisible: MutableStateFlow<Boolean> } @SysUISingleton Loading Loading @@ -110,6 +113,8 @@ constructor( override val isVisible: MutableStateFlow<Boolean> = MutableStateFlow(false) override val isImeVisible: MutableStateFlow<Boolean> = MutableStateFlow(false) companion object { // Privately defined card type, exclusive for ambient actions @VisibleForTesting const val AMBIENT_ACTION_FEATURE = 72 Loading packages/SystemUI/src/com/android/systemui/ambientcue/domain/interactor/AmbientCueInteractor.kt +5 −0 Original line number Diff line number Diff line Loading @@ -25,8 +25,13 @@ import kotlinx.coroutines.flow.update class AmbientCueInteractor @Inject constructor(private val repository: AmbientCueRepository) { val isVisible: StateFlow<Boolean> = repository.isVisible val actions: StateFlow<List<ActionModel>> = repository.actions val isImeVisible: StateFlow<Boolean> = repository.isImeVisible fun setIsVisible(visible: Boolean) { repository.isVisible.update { visible } } fun setIsImeVisible(visible: Boolean) { repository.isImeVisible.update { visible } } } packages/SystemUI/src/com/android/systemui/ambientcue/ui/startable/AmbientCueCoreStartable.kt +7 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.ambientcue.ui.startable import android.util.Log import android.view.WindowInsets.Type.ime import android.view.WindowManager import com.android.systemui.CoreStartable import com.android.systemui.ambientcue.domain.interactor.AmbientCueInteractor Loading Loading @@ -62,6 +63,12 @@ constructor( } } } ambientCueWindowRootView.setOnApplyWindowInsetsListener { _, insets -> val imeVisible = insets.isVisible(ime()) ambientCueInteractor.setIsImeVisible(imeVisible) insets } } private fun createAmbientCueView() { Loading packages/SystemUI/src/com/android/systemui/ambientcue/ui/view/AmbientCueUtils.kt +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ object AmbientCueUtils { if (spyTouches) { inputFeatures = inputFeatures or LayoutParams.INPUT_FEATURE_SPY } receiveInsetsIgnoringZOrder = true } } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/ambientcue/domain/interactor/AmbientCueInteractorTest.kt +16 −0 Original line number Diff line number Diff line Loading @@ -73,4 +73,20 @@ class AmbientCueInteractorTest : SysuiTestCase() { ambientCueRepository.fake.setActions(testActions) assertThat(actions).isEqualTo(testActions) } @Test fun isImeVisible_setTrue_true() = kosmos.runTest { val isImeVisible by collectLastValue(ambientCueInteractor.isImeVisible) ambientCueInteractor.setIsImeVisible(true) assertThat(isImeVisible).isTrue() } @Test fun isImeVisible_setFalse_false() = kosmos.runTest { val isImeVisible by collectLastValue(ambientCueInteractor.isImeVisible) ambientCueInteractor.setIsImeVisible(false) assertThat(isImeVisible).isFalse() } }
packages/SystemUI/src/com/android/systemui/ambientcue/data/repository/AmbientCueRepository.kt +5 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,9 @@ interface AmbientCueRepository { /** If hint (or chips list) should be visible. */ val isVisible: MutableStateFlow<Boolean> /** If IME is visible or not. */ val isImeVisible: MutableStateFlow<Boolean> } @SysUISingleton Loading Loading @@ -110,6 +113,8 @@ constructor( override val isVisible: MutableStateFlow<Boolean> = MutableStateFlow(false) override val isImeVisible: MutableStateFlow<Boolean> = MutableStateFlow(false) companion object { // Privately defined card type, exclusive for ambient actions @VisibleForTesting const val AMBIENT_ACTION_FEATURE = 72 Loading
packages/SystemUI/src/com/android/systemui/ambientcue/domain/interactor/AmbientCueInteractor.kt +5 −0 Original line number Diff line number Diff line Loading @@ -25,8 +25,13 @@ import kotlinx.coroutines.flow.update class AmbientCueInteractor @Inject constructor(private val repository: AmbientCueRepository) { val isVisible: StateFlow<Boolean> = repository.isVisible val actions: StateFlow<List<ActionModel>> = repository.actions val isImeVisible: StateFlow<Boolean> = repository.isImeVisible fun setIsVisible(visible: Boolean) { repository.isVisible.update { visible } } fun setIsImeVisible(visible: Boolean) { repository.isImeVisible.update { visible } } }
packages/SystemUI/src/com/android/systemui/ambientcue/ui/startable/AmbientCueCoreStartable.kt +7 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.ambientcue.ui.startable import android.util.Log import android.view.WindowInsets.Type.ime import android.view.WindowManager import com.android.systemui.CoreStartable import com.android.systemui.ambientcue.domain.interactor.AmbientCueInteractor Loading Loading @@ -62,6 +63,12 @@ constructor( } } } ambientCueWindowRootView.setOnApplyWindowInsetsListener { _, insets -> val imeVisible = insets.isVisible(ime()) ambientCueInteractor.setIsImeVisible(imeVisible) insets } } private fun createAmbientCueView() { Loading
packages/SystemUI/src/com/android/systemui/ambientcue/ui/view/AmbientCueUtils.kt +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ object AmbientCueUtils { if (spyTouches) { inputFeatures = inputFeatures or LayoutParams.INPUT_FEATURE_SPY } receiveInsetsIgnoringZOrder = true } } }