Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalAutoOpenInteractorTest.kt +4 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ package com.android.systemui.communal.domain.interactor import android.platform.test.annotations.EnableFlags import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2 import com.android.systemui.SysuiTestCase import com.android.systemui.common.data.repository.batteryRepository import com.android.systemui.common.data.repository.fake Loading Loading @@ -47,6 +49,7 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) @EnableFlags(FLAG_GLANCEABLE_HUB_V2) class CommunalAutoOpenInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() Loading @@ -54,6 +57,7 @@ class CommunalAutoOpenInteractorTest : SysuiTestCase() { @Before fun setUp() { kosmos.setCommunalV2ConfigEnabled(true) runBlocking { kosmos.fakeUserRepository.asMainUser() } with(kosmos.fakeSettings) { putIntForUser( Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSettingsInteractorTest.kt +4 −0 Original line number Diff line number Diff line Loading @@ -21,9 +21,11 @@ import android.app.admin.devicePolicyManager import android.content.Intent import android.content.pm.UserInfo import android.os.UserManager import android.platform.test.annotations.EnableFlags import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2 import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.broadcastDispatcher import com.android.systemui.communal.shared.model.WhenToStartHub Loading Loading @@ -86,8 +88,10 @@ class CommunalSettingsInteractorTest : SysuiTestCase() { } @Test @EnableFlags(FLAG_GLANCEABLE_HUB_V2) fun whenToStartHub_matchesRepository() = kosmos.runTest { setCommunalV2ConfigEnabled(true) fakeSettings.putIntForUser( Settings.Secure.WHEN_TO_START_GLANCEABLE_HUB, Settings.Secure.GLANCEABLE_HUB_START_CHARGING, Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/posturing/domain/interactor/PosturingInteractorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class PosturingInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() private val underTest by lazy { kosmos.posturingInteractor } private val Kosmos.underTest by Kosmos.Fixture { kosmos.posturingInteractor } @Test fun testNoDebugOverride() = Loading packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalSettingsRepository.kt +7 −2 Original line number Diff line number Diff line Loading @@ -206,8 +206,11 @@ constructor( } .flowOn(bgDispatcher) override fun getWhenToStartHubState(user: UserInfo): Flow<WhenToStartHub> = secureSettings override fun getWhenToStartHubState(user: UserInfo): Flow<WhenToStartHub> { if (!getV2FlagEnabled()) { return MutableStateFlow(WhenToStartHub.NEVER) } return secureSettings .observerFlow( userId = user.id, names = arrayOf(Settings.Secure.WHEN_TO_START_GLANCEABLE_HUB), Loading @@ -225,11 +228,13 @@ constructor( Settings.Secure.GLANCEABLE_HUB_START_CHARGING -> WhenToStartHub.WHILE_CHARGING Settings.Secure.GLANCEABLE_HUB_START_CHARGING_UPRIGHT -> WhenToStartHub.WHILE_CHARGING_AND_POSTURED Settings.Secure.GLANCEABLE_HUB_START_DOCKED -> WhenToStartHub.WHILE_DOCKED else -> WhenToStartHub.NEVER } } .flowOn(bgDispatcher) } override fun getAllowedByDevicePolicy(user: UserInfo): Flow<Boolean> = broadcastDispatcher Loading packages/SystemUI/src/com/android/systemui/communal/posturing/domain/interactor/PosturingInteractor.kt +3 −9 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.annotation.SuppressLint import android.hardware.Sensor import android.hardware.TriggerEvent import android.hardware.TriggerEventListener import android.service.dreams.Flags.allowDreamWhenPostured import com.android.systemui.communal.posturing.data.model.PositionState import com.android.systemui.communal.posturing.data.repository.PosturingRepository import com.android.systemui.communal.posturing.shared.model.PosturedState Loading Loading @@ -170,15 +169,10 @@ constructor( * NOTE: Due to smoothing, this signal may be delayed to ensure we have a stable reading before * being considered postured. */ val postured: Flow<Boolean> by lazy { if (allowDreamWhenPostured()) { val postured: Flow<Boolean> = combine(posturedSmoothed, debugPostured) { postured, debugValue -> debugValue.asBoolean() ?: postured.asBoolean() ?: false } } else { MutableStateFlow(false) } } /** * Helper for observing a trigger sensor, which automatically unregisters itself after it Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalAutoOpenInteractorTest.kt +4 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ package com.android.systemui.communal.domain.interactor import android.platform.test.annotations.EnableFlags import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2 import com.android.systemui.SysuiTestCase import com.android.systemui.common.data.repository.batteryRepository import com.android.systemui.common.data.repository.fake Loading Loading @@ -47,6 +49,7 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) @EnableFlags(FLAG_GLANCEABLE_HUB_V2) class CommunalAutoOpenInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() Loading @@ -54,6 +57,7 @@ class CommunalAutoOpenInteractorTest : SysuiTestCase() { @Before fun setUp() { kosmos.setCommunalV2ConfigEnabled(true) runBlocking { kosmos.fakeUserRepository.asMainUser() } with(kosmos.fakeSettings) { putIntForUser( Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSettingsInteractorTest.kt +4 −0 Original line number Diff line number Diff line Loading @@ -21,9 +21,11 @@ import android.app.admin.devicePolicyManager import android.content.Intent import android.content.pm.UserInfo import android.os.UserManager import android.platform.test.annotations.EnableFlags import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2 import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.broadcastDispatcher import com.android.systemui.communal.shared.model.WhenToStartHub Loading Loading @@ -86,8 +88,10 @@ class CommunalSettingsInteractorTest : SysuiTestCase() { } @Test @EnableFlags(FLAG_GLANCEABLE_HUB_V2) fun whenToStartHub_matchesRepository() = kosmos.runTest { setCommunalV2ConfigEnabled(true) fakeSettings.putIntForUser( Settings.Secure.WHEN_TO_START_GLANCEABLE_HUB, Settings.Secure.GLANCEABLE_HUB_START_CHARGING, Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/posturing/domain/interactor/PosturingInteractorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class PosturingInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() private val underTest by lazy { kosmos.posturingInteractor } private val Kosmos.underTest by Kosmos.Fixture { kosmos.posturingInteractor } @Test fun testNoDebugOverride() = Loading
packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalSettingsRepository.kt +7 −2 Original line number Diff line number Diff line Loading @@ -206,8 +206,11 @@ constructor( } .flowOn(bgDispatcher) override fun getWhenToStartHubState(user: UserInfo): Flow<WhenToStartHub> = secureSettings override fun getWhenToStartHubState(user: UserInfo): Flow<WhenToStartHub> { if (!getV2FlagEnabled()) { return MutableStateFlow(WhenToStartHub.NEVER) } return secureSettings .observerFlow( userId = user.id, names = arrayOf(Settings.Secure.WHEN_TO_START_GLANCEABLE_HUB), Loading @@ -225,11 +228,13 @@ constructor( Settings.Secure.GLANCEABLE_HUB_START_CHARGING -> WhenToStartHub.WHILE_CHARGING Settings.Secure.GLANCEABLE_HUB_START_CHARGING_UPRIGHT -> WhenToStartHub.WHILE_CHARGING_AND_POSTURED Settings.Secure.GLANCEABLE_HUB_START_DOCKED -> WhenToStartHub.WHILE_DOCKED else -> WhenToStartHub.NEVER } } .flowOn(bgDispatcher) } override fun getAllowedByDevicePolicy(user: UserInfo): Flow<Boolean> = broadcastDispatcher Loading
packages/SystemUI/src/com/android/systemui/communal/posturing/domain/interactor/PosturingInteractor.kt +3 −9 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.annotation.SuppressLint import android.hardware.Sensor import android.hardware.TriggerEvent import android.hardware.TriggerEventListener import android.service.dreams.Flags.allowDreamWhenPostured import com.android.systemui.communal.posturing.data.model.PositionState import com.android.systemui.communal.posturing.data.repository.PosturingRepository import com.android.systemui.communal.posturing.shared.model.PosturedState Loading Loading @@ -170,15 +169,10 @@ constructor( * NOTE: Due to smoothing, this signal may be delayed to ensure we have a stable reading before * being considered postured. */ val postured: Flow<Boolean> by lazy { if (allowDreamWhenPostured()) { val postured: Flow<Boolean> = combine(posturedSmoothed, debugPostured) { postured, debugValue -> debugValue.asBoolean() ?: postured.asBoolean() ?: false } } else { MutableStateFlow(false) } } /** * Helper for observing a trigger sensor, which automatically unregisters itself after it Loading