Loading packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -427,7 +427,7 @@ class KeyboardTouchpadEduInteractorTest(private val gestureType: GestureType) : @After fun clear() { testScope.launch { tutorialSchedulerRepository.clearDataStore() } testScope.launch { tutorialSchedulerRepository.clear() } } private suspend fun triggerMaxEducationSignals(gestureType: GestureType) { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/data/repository/TutorialSchedulerRepositoryTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -47,13 +47,13 @@ class TutorialSchedulerRepositoryTest : SysuiTestCase() { TutorialSchedulerRepository( context, testScope.backgroundScope, "TutorialSchedulerRepositoryTest" "TutorialSchedulerRepositoryTest", ) } @After fun clear() { testScope.launch { underTest.clearDataStore() } testScope.launch { underTest.clear() } } @Test Loading packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialNotificationCoordinatorTest.kt +5 −3 Original line number Diff line number Diff line Loading @@ -26,10 +26,11 @@ import com.android.systemui.inputdevice.tutorial.data.repository.TutorialSchedul import com.android.systemui.inputdevice.tutorial.inputDeviceTutorialLogger import com.android.systemui.inputdevice.tutorial.ui.TutorialNotificationCoordinator import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.settings.userTracker import com.android.systemui.statusbar.commandline.commandRegistry import com.android.systemui.testKosmos import com.android.systemui.touchpad.data.repository.FakeTouchpadRepository import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.hours Loading Loading @@ -60,7 +61,7 @@ import org.mockito.kotlin.verify class TutorialNotificationCoordinatorTest : SysuiTestCase() { private lateinit var underTest: TutorialNotificationCoordinator private val kosmos = Kosmos() private val kosmos = testKosmos() private val testScope = kosmos.testScope private val keyboardRepository = FakeKeyboardRepository() private val touchpadRepository = FakeTouchpadRepository() Loading @@ -85,6 +86,7 @@ class TutorialNotificationCoordinatorTest : SysuiTestCase() { touchpadRepository, repository, kosmos.inputDeviceTutorialLogger, kosmos.commandRegistry, ) underTest = TutorialNotificationCoordinator( Loading @@ -100,7 +102,7 @@ class TutorialNotificationCoordinatorTest : SysuiTestCase() { @After fun clear() { runBlocking { repository.clearDataStore() } runBlocking { repository.clear() } dataStoreScope.cancel() } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialSchedulerInteractorTest.kt +5 −3 Original line number Diff line number Diff line Loading @@ -24,8 +24,9 @@ import com.android.systemui.inputdevice.tutorial.data.repository.TutorialSchedul import com.android.systemui.inputdevice.tutorial.domain.interactor.TutorialSchedulerInteractor.TutorialType import com.android.systemui.inputdevice.tutorial.inputDeviceTutorialLogger import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.commandline.commandRegistry import com.android.systemui.testKosmos import com.android.systemui.touchpad.data.repository.FakeTouchpadRepository import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.hours Loading @@ -49,7 +50,7 @@ import org.junit.runner.RunWith class TutorialSchedulerInteractorTest : SysuiTestCase() { private lateinit var underTest: TutorialSchedulerInteractor private val kosmos = Kosmos() private val kosmos = testKosmos() private val testScope = kosmos.testScope private lateinit var dataStoreScope: CoroutineScope private val keyboardRepository = FakeKeyboardRepository() Loading @@ -71,12 +72,13 @@ class TutorialSchedulerInteractorTest : SysuiTestCase() { touchpadRepository, schedulerRepository, kosmos.inputDeviceTutorialLogger, kosmos.commandRegistry, ) } @After fun clear() { runBlocking { schedulerRepository.clearDataStore() } runBlocking { schedulerRepository.clear() } dataStoreScope.cancel() } Loading packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/data/repository/TutorialSchedulerRepository.kt +5 −7 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.inputdevice.tutorial.data.repository import android.content.Context import androidx.annotation.VisibleForTesting import androidx.datastore.core.DataStore import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.core.edit Loading @@ -37,12 +36,12 @@ import kotlinx.coroutines.flow.map class TutorialSchedulerRepository( private val applicationContext: Context, backgroundScope: CoroutineScope, dataStoreName: String dataStoreName: String, ) { @Inject constructor( @Application applicationContext: Context, @Background backgroundScope: CoroutineScope @Background backgroundScope: CoroutineScope, ) : this(applicationContext, backgroundScope, dataStoreName = DATASTORE_NAME) private val Context.dataStore: DataStore<Preferences> by Loading Loading @@ -73,7 +72,7 @@ class TutorialSchedulerRepository( private fun getSchedulerInfo(pref: Preferences): Map<DeviceType, DeviceSchedulerInfo> { return mapOf( DeviceType.KEYBOARD to getDeviceSchedulerInfo(pref, DeviceType.KEYBOARD), DeviceType.TOUCHPAD to getDeviceSchedulerInfo(pref, DeviceType.TOUCHPAD) DeviceType.TOUCHPAD to getDeviceSchedulerInfo(pref, DeviceType.TOUCHPAD), ) } Loading @@ -89,8 +88,7 @@ class TutorialSchedulerRepository( private fun getConnectKey(device: DeviceType) = longPreferencesKey(device.name + CONNECT_TIME_SUFFIX) @VisibleForTesting suspend fun clearDataStore() { suspend fun clear() { applicationContext.dataStore.edit { it.clear() } } Loading @@ -103,5 +101,5 @@ class TutorialSchedulerRepository( enum class DeviceType { KEYBOARD, TOUCHPAD TOUCHPAD, } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -427,7 +427,7 @@ class KeyboardTouchpadEduInteractorTest(private val gestureType: GestureType) : @After fun clear() { testScope.launch { tutorialSchedulerRepository.clearDataStore() } testScope.launch { tutorialSchedulerRepository.clear() } } private suspend fun triggerMaxEducationSignals(gestureType: GestureType) { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/data/repository/TutorialSchedulerRepositoryTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -47,13 +47,13 @@ class TutorialSchedulerRepositoryTest : SysuiTestCase() { TutorialSchedulerRepository( context, testScope.backgroundScope, "TutorialSchedulerRepositoryTest" "TutorialSchedulerRepositoryTest", ) } @After fun clear() { testScope.launch { underTest.clearDataStore() } testScope.launch { underTest.clear() } } @Test Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialNotificationCoordinatorTest.kt +5 −3 Original line number Diff line number Diff line Loading @@ -26,10 +26,11 @@ import com.android.systemui.inputdevice.tutorial.data.repository.TutorialSchedul import com.android.systemui.inputdevice.tutorial.inputDeviceTutorialLogger import com.android.systemui.inputdevice.tutorial.ui.TutorialNotificationCoordinator import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.settings.userTracker import com.android.systemui.statusbar.commandline.commandRegistry import com.android.systemui.testKosmos import com.android.systemui.touchpad.data.repository.FakeTouchpadRepository import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.hours Loading Loading @@ -60,7 +61,7 @@ import org.mockito.kotlin.verify class TutorialNotificationCoordinatorTest : SysuiTestCase() { private lateinit var underTest: TutorialNotificationCoordinator private val kosmos = Kosmos() private val kosmos = testKosmos() private val testScope = kosmos.testScope private val keyboardRepository = FakeKeyboardRepository() private val touchpadRepository = FakeTouchpadRepository() Loading @@ -85,6 +86,7 @@ class TutorialNotificationCoordinatorTest : SysuiTestCase() { touchpadRepository, repository, kosmos.inputDeviceTutorialLogger, kosmos.commandRegistry, ) underTest = TutorialNotificationCoordinator( Loading @@ -100,7 +102,7 @@ class TutorialNotificationCoordinatorTest : SysuiTestCase() { @After fun clear() { runBlocking { repository.clearDataStore() } runBlocking { repository.clear() } dataStoreScope.cancel() } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialSchedulerInteractorTest.kt +5 −3 Original line number Diff line number Diff line Loading @@ -24,8 +24,9 @@ import com.android.systemui.inputdevice.tutorial.data.repository.TutorialSchedul import com.android.systemui.inputdevice.tutorial.domain.interactor.TutorialSchedulerInteractor.TutorialType import com.android.systemui.inputdevice.tutorial.inputDeviceTutorialLogger import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.commandline.commandRegistry import com.android.systemui.testKosmos import com.android.systemui.touchpad.data.repository.FakeTouchpadRepository import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.hours Loading @@ -49,7 +50,7 @@ import org.junit.runner.RunWith class TutorialSchedulerInteractorTest : SysuiTestCase() { private lateinit var underTest: TutorialSchedulerInteractor private val kosmos = Kosmos() private val kosmos = testKosmos() private val testScope = kosmos.testScope private lateinit var dataStoreScope: CoroutineScope private val keyboardRepository = FakeKeyboardRepository() Loading @@ -71,12 +72,13 @@ class TutorialSchedulerInteractorTest : SysuiTestCase() { touchpadRepository, schedulerRepository, kosmos.inputDeviceTutorialLogger, kosmos.commandRegistry, ) } @After fun clear() { runBlocking { schedulerRepository.clearDataStore() } runBlocking { schedulerRepository.clear() } dataStoreScope.cancel() } Loading
packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/data/repository/TutorialSchedulerRepository.kt +5 −7 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.inputdevice.tutorial.data.repository import android.content.Context import androidx.annotation.VisibleForTesting import androidx.datastore.core.DataStore import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.core.edit Loading @@ -37,12 +36,12 @@ import kotlinx.coroutines.flow.map class TutorialSchedulerRepository( private val applicationContext: Context, backgroundScope: CoroutineScope, dataStoreName: String dataStoreName: String, ) { @Inject constructor( @Application applicationContext: Context, @Background backgroundScope: CoroutineScope @Background backgroundScope: CoroutineScope, ) : this(applicationContext, backgroundScope, dataStoreName = DATASTORE_NAME) private val Context.dataStore: DataStore<Preferences> by Loading Loading @@ -73,7 +72,7 @@ class TutorialSchedulerRepository( private fun getSchedulerInfo(pref: Preferences): Map<DeviceType, DeviceSchedulerInfo> { return mapOf( DeviceType.KEYBOARD to getDeviceSchedulerInfo(pref, DeviceType.KEYBOARD), DeviceType.TOUCHPAD to getDeviceSchedulerInfo(pref, DeviceType.TOUCHPAD) DeviceType.TOUCHPAD to getDeviceSchedulerInfo(pref, DeviceType.TOUCHPAD), ) } Loading @@ -89,8 +88,7 @@ class TutorialSchedulerRepository( private fun getConnectKey(device: DeviceType) = longPreferencesKey(device.name + CONNECT_TIME_SUFFIX) @VisibleForTesting suspend fun clearDataStore() { suspend fun clear() { applicationContext.dataStore.edit { it.clear() } } Loading @@ -103,5 +101,5 @@ class TutorialSchedulerRepository( enum class DeviceType { KEYBOARD, TOUCHPAD TOUCHPAD, }