Merge "Clean up @OptIn(ExperimentalCoroutinesApi::class)" into main
diff --git a/tests/spa_unit/src/com/android/settings/applications/specialaccess/DataSaverControllerTest.kt b/tests/spa_unit/src/com/android/settings/applications/specialaccess/DataSaverControllerTest.kt
index c2413af..5d3c1c0 100644
--- a/tests/spa_unit/src/com/android/settings/applications/specialaccess/DataSaverControllerTest.kt
+++ b/tests/spa_unit/src/com/android/settings/applications/specialaccess/DataSaverControllerTest.kt
@@ -29,7 +29,6 @@
import com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE
import com.android.settingslib.spaprivileged.model.app.AppListRepository
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
@@ -43,7 +42,6 @@
import org.mockito.junit.MockitoRule
import org.mockito.Mockito.`when` as whenever
-@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class DataSaverControllerTest {
@get:Rule
diff --git a/tests/spa_unit/src/com/android/settings/network/telephony/DataUsagePreferenceControllerTest.kt b/tests/spa_unit/src/com/android/settings/network/telephony/DataUsagePreferenceControllerTest.kt
index 342ebeb..a6d1531 100644
--- a/tests/spa_unit/src/com/android/settings/network/telephony/DataUsagePreferenceControllerTest.kt
+++ b/tests/spa_unit/src/com/android/settings/network/telephony/DataUsagePreferenceControllerTest.kt
@@ -37,7 +37,6 @@
import com.android.settingslib.net.DataUsageController.DataUsageInfo
import com.android.settingslib.spa.testutils.waitUntil
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.After
import org.junit.Before
@@ -53,7 +52,6 @@
import org.mockito.quality.Strictness
import org.mockito.Mockito.`when` as whenever
-@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class DataUsagePreferenceControllerTest {
diff --git a/tests/spa_unit/src/com/android/settings/network/telephony/TelephonyStatusControlSessionTest.kt b/tests/spa_unit/src/com/android/settings/network/telephony/TelephonyStatusControlSessionTest.kt
index 7e6a91b..cf6b919 100644
--- a/tests/spa_unit/src/com/android/settings/network/telephony/TelephonyStatusControlSessionTest.kt
+++ b/tests/spa_unit/src/com/android/settings/network/telephony/TelephonyStatusControlSessionTest.kt
@@ -23,12 +23,10 @@
import com.android.settings.core.BasePreferenceController
import com.android.settingslib.spa.testutils.waitUntil
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.Test
import org.junit.runner.RunWith
-@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class TelephonyStatusControlSessionTest {
private val context: Context = ApplicationProvider.getApplicationContext()
diff --git a/tests/spa_unit/src/com/android/settings/spa/app/AllAppListTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/AllAppListTest.kt
index 2e7752e..97a5a81 100644
--- a/tests/spa_unit/src/com/android/settings/spa/app/AllAppListTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/app/AllAppListTest.kt
@@ -33,7 +33,6 @@
import com.android.settingslib.spaprivileged.template.app.AppListInput
import com.android.settingslib.spaprivileged.template.app.AppListItemModel
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
import org.junit.Rule
@@ -118,7 +117,6 @@
.isEqualTo("AppInfoSettings/package.name/0")
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun allAppListModel_transform() = runTest {
val listModel = AllAppListModel(context) { stateOf(SUMMARY) }
diff --git a/tests/spa_unit/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProviderTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProviderTest.kt
index 0d2869c..19176f8 100644
--- a/tests/spa_unit/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProviderTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProviderTest.kt
@@ -34,7 +34,6 @@
import com.android.settingslib.spa.testutils.firstWithTimeoutOrNull
import com.android.settingslib.spaprivileged.template.app.AppListItemModel
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
import org.junit.Rule
@@ -67,14 +66,16 @@
@Test
fun injectEntry_summary() {
setInjectEntry()
- composeTestRule.onNodeWithText(context.getString(R.string.aspect_ratio_summary, Build.MODEL))
+ composeTestRule
+ .onNodeWithText(context.getString(R.string.aspect_ratio_summary, Build.MODEL))
.assertIsDisplayed()
}
@Test
fun injectEntry_onClick_navigate() {
setInjectEntry()
- composeTestRule.onNodeWithText(context.getString(R.string.aspect_ratio_title)).performClick()
+ composeTestRule.onNodeWithText(context.getString(R.string.aspect_ratio_title))
+ .performClick()
assertThat(fakeNavControllerWrapper.navigateCalledWith).isEqualTo("UserAspectRatioAppsPage")
}
@@ -103,7 +104,6 @@
composeTestRule.onNodeWithText(LABEL).assertIsDisplayed()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun aspectRatioAppListModel_transform() = runTest {
val listModel = UserAspectRatioAppListModel(context)
@@ -114,7 +114,6 @@
assertThat(recordList[0].app).isSameInstanceAs(APP)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun aspectRatioAppListModel_filter() = runTest {
val listModel = UserAspectRatioAppListModel(context)
diff --git a/tests/spa_unit/src/com/android/settings/spa/app/appinfo/PackageInfoPresenterTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/appinfo/PackageInfoPresenterTest.kt
index 3bfa90e..2648e08 100644
--- a/tests/spa_unit/src/com/android/settings/spa/app/appinfo/PackageInfoPresenterTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/app/appinfo/PackageInfoPresenterTest.kt
@@ -28,7 +28,6 @@
import com.android.settingslib.spaprivileged.framework.common.activityManager
import com.android.settingslib.spaprivileged.model.app.IPackageManagers
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.test.runTest
import org.junit.Before
@@ -45,7 +44,6 @@
import org.mockito.junit.MockitoRule
import org.mockito.Mockito.`when` as whenever
-@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class PackageInfoPresenterTest {
@get:Rule
diff --git a/tests/spa_unit/src/com/android/settings/spa/app/backgroundinstall/BackgroundInstalledAppsPageProviderTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/backgroundinstall/BackgroundInstalledAppsPageProviderTest.kt
index b3e29af..68ad065 100644
--- a/tests/spa_unit/src/com/android/settings/spa/app/backgroundinstall/BackgroundInstalledAppsPageProviderTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/app/backgroundinstall/BackgroundInstalledAppsPageProviderTest.kt
@@ -34,7 +34,6 @@
import com.android.settingslib.spa.testutils.any
import com.android.settingslib.spaprivileged.template.app.AppListItemModel
import com.google.common.truth.Truth
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
@@ -171,7 +170,6 @@
.isEqualTo("AppInfoSettings/package.name/0")
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun backgroundInstalledAppsWithGroupingListModel_getGroupTitleOne() = runTest {
val listModel = BackgroundInstalledAppsWithGroupingListModel(context)
@@ -186,7 +184,6 @@
Truth.assertThat(actualGroupTitle).isEqualTo("Apps installed in the last 6 months")
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun backgroundInstalledAppsWithGroupingListModel_getGroupTitleTwo() = runTest {
val listModel = BackgroundInstalledAppsWithGroupingListModel(context)
@@ -201,7 +198,6 @@
Truth.assertThat(actualGroupTitle).isEqualTo("Apps installed more than 6 months ago")
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun backgroundInstalledAppsWithGroupingListModel_transform() = runTest {
val listModel = BackgroundInstalledAppsWithGroupingListModel(mockContext)
@@ -220,7 +216,6 @@
Truth.assertThat(packageInfoFlagsCaptor.value.value).isEqualTo(EXPECTED_PACKAGE_INFO_FLAG)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun backgroundInstalledAppsWithGroupingListModel_filter() = runTest {
val listModel = BackgroundInstalledAppsWithGroupingListModel(mockContext)
diff --git a/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/PictureInPictureTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/PictureInPictureTest.kt
index fb0fb69..6054bb5 100644
--- a/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/PictureInPictureTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/PictureInPictureTest.kt
@@ -29,7 +29,6 @@
import com.android.settings.R
import com.android.settingslib.spaprivileged.model.app.AppOpsController
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
@@ -46,7 +45,6 @@
import org.mockito.junit.MockitoRule
import org.mockito.Mockito.`when` as whenever
-@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class PictureInPictureTest {
@get:Rule
diff --git a/tests/spa_unit/src/com/android/settings/spa/development/compat/PlatformCompatAppListModelTest.kt b/tests/spa_unit/src/com/android/settings/spa/development/compat/PlatformCompatAppListModelTest.kt
index 78aca85..0cfdc7d 100644
--- a/tests/spa_unit/src/com/android/settings/spa/development/compat/PlatformCompatAppListModelTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/development/compat/PlatformCompatAppListModelTest.kt
@@ -25,7 +25,6 @@
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
@@ -41,7 +40,6 @@
import org.mockito.junit.MockitoRule
import org.mockito.Mockito.`when` as whenever
-@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class PlatformCompatAppListModelTest {
@get:Rule
diff --git a/tests/spa_unit/src/com/android/settings/spa/notification/AppNotificationRepositoryTest.kt b/tests/spa_unit/src/com/android/settings/spa/notification/AppNotificationRepositoryTest.kt
index 12fdc23..87ff9ba 100644
--- a/tests/spa_unit/src/com/android/settings/spa/notification/AppNotificationRepositoryTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/notification/AppNotificationRepositoryTest.kt
@@ -34,7 +34,6 @@
import com.android.settingslib.spaprivileged.model.app.IPackageManagers
import com.android.settingslib.spaprivileged.model.app.userId
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
@@ -49,7 +48,6 @@
import org.mockito.junit.MockitoRule
import org.mockito.Mockito.`when` as whenever
-@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class AppNotificationRepositoryTest {
@get:Rule
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/AutoCredentialViewModelTest.kt b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/AutoCredentialViewModelTest.kt
index 976caed..e708f3b 100644
--- a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/AutoCredentialViewModelTest.kt
+++ b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/AutoCredentialViewModelTest.kt
@@ -35,7 +35,7 @@
import com.android.settings.password.ChooseLockPattern
import com.android.settings.password.ChooseLockSettingsHelper
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
+import java.util.concurrent.atomic.AtomicBoolean
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.TestScope
@@ -50,7 +50,6 @@
import org.mockito.Mockito
import org.mockito.junit.MockitoJUnit
import org.mockito.junit.MockitoRule
-import java.util.concurrent.atomic.AtomicBoolean
import org.mockito.Mockito.`when` as whenever
@RunWith(AndroidJUnit4::class)
@@ -86,7 +85,6 @@
challengeGenerator.challenge = newChallenge
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckCredential_validCredentialCase() = runTest {
val userId = 99
@@ -109,7 +107,6 @@
assertThat(viewModel.createGeneratingChallengeExtras()).isNull()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckCredential_needToChooseLock() = runTest {
val userId = 100
@@ -132,7 +129,6 @@
assertThat(viewModel.createGeneratingChallengeExtras()).isNull()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckCredential_needToConfirmLockForSomething() = runTest {
val userId = 101
@@ -156,7 +152,6 @@
assertThat(viewModel.createGeneratingChallengeExtras()).isNull()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckCredential_needToConfirmLockForNumeric() = runTest {
val userId = 102
@@ -180,7 +175,6 @@
assertThat(viewModel.createGeneratingChallengeExtras()).isNull()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckCredential_needToConfirmLockForAlphabetic() = runTest {
val userId = 103
@@ -204,7 +198,6 @@
assertThat(viewModel.createGeneratingChallengeExtras()).isNull()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckCredential_generateChallenge() = runTest {
val userId = 104
@@ -258,7 +251,6 @@
assertThat(tokens[0]).isEqualTo(1)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckCredential_generateChallengeFail() = runTest {
backgroundScope.launch {
@@ -306,7 +298,6 @@
assertThat(viewModel.userId).isEqualTo(userId)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testGenerateChallengeAsCredentialActivityResult_invalidChooseLock() = runTest {
backgroundScope.launch {
@@ -332,7 +323,6 @@
}
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testGenerateChallengeAsCredentialActivityResult_invalidConfirmLock() = runTest {
backgroundScope.launch {
@@ -358,7 +348,6 @@
}
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testGenerateChallengeAsCredentialActivityResult_nullDataChooseLock() = runTest {
val userId = 108
@@ -380,7 +369,6 @@
assertThat(generateFails.size).isEqualTo(0)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testGenerateChallengeAsCredentialActivityResult_nullDataConfirmLock() = runTest {
val userId = 109
@@ -401,7 +389,6 @@
assertThat(generateFails.size).isEqualTo(0)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testGenerateChallengeAsCredentialActivityResult_validChooseLock() = runTest {
val userId = 108
@@ -447,7 +434,6 @@
assertThat(hasCalledRemoveGkPwHandle.get()).isTrue()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testGenerateChallengeAsCredentialActivityResult_validConfirmLock() = runTest {
val userId = 109
@@ -493,7 +479,6 @@
assertThat(hasCalledRemoveGkPwHandle.get()).isTrue()
}
- @OptIn(ExperimentalCoroutinesApi::class)
private fun TestScope.listOfGenerateChallengeFailedFlow(): List<Boolean> =
mutableListOf<Boolean>().also {
backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) {
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollErrorDialogViewModelTest.kt b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollErrorDialogViewModelTest.kt
index 3679dd2..379a5c1 100644
--- a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollErrorDialogViewModelTest.kt
+++ b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollErrorDialogViewModelTest.kt
@@ -19,12 +19,9 @@
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.settings.biometrics2.ui.viewmodel.FingerprintErrorDialogSetResultAction.FINGERPRINT_ERROR_DIALOG_ACTION_SET_RESULT_FINISH
-import com.android.settings.biometrics2.ui.viewmodel.FingerprintErrorDialogSetResultAction.FINGERPRINT_ERROR_DIALOG_ACTION_SET_RESULT_TIMEOUT
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.launch
-import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
@@ -56,7 +53,6 @@
assertThat(FingerprintEnrollErrorDialogViewModel(application, true).isSuw).isTrue()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testNewDialog() = runTest {
val newDialogs: List<Int> = mutableListOf<Int>().also {
@@ -81,7 +77,6 @@
assertThat(newDialogs[0]).isEqualTo(testErrorMsgId)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testTriggerRetry() = runTest {
val triggerRetries: List<Any> = mutableListOf<Any>().also {
@@ -102,7 +97,6 @@
assertThat(triggerRetries.size).isEqualTo(1)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testSetResultFinish() = runTest {
val setResults: List<FingerprintErrorDialogSetResultAction> =
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModelTest.kt b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModelTest.kt
index 08e5ac3..7494aef 100644
--- a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModelTest.kt
+++ b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModelTest.kt
@@ -38,7 +38,6 @@
import com.android.settings.biometrics2.utils.FingerprintRepositoryUtils.setupFingerprintEnrolledFingerprints
import com.android.settings.biometrics2.utils.FingerprintRepositoryUtils.setupSuwMaxFingerprintsEnrollable
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.TestScope
@@ -78,7 +77,6 @@
application = ApplicationProvider.getApplicationContext()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testPageStatusFlowDefaultAndUpdate() = runTest {
val viewModel = newFingerprintEnrollIntroViewModel(
@@ -105,7 +103,6 @@
assertThat(statusList[1].enrollableStatus).isEqualTo(FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX)
}
- @OptIn(ExperimentalCoroutinesApi::class)
fun testOnStartToUpdateEnrollableStatusOk_isSuw() = runTest {
setupFingerprintEnrolledFingerprints(fingerprintManager, TEST_USER_ID, 0)
setupSuwMaxFingerprintsEnrollable(application, resources, 1)
@@ -122,7 +119,6 @@
assertThat(statusList[0].enrollableStatus).isEqualTo(FINGERPRINT_ENROLLABLE_OK)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusReachMax_isSuw() = runTest {
setupFingerprintEnrolledFingerprints(fingerprintManager, TEST_USER_ID, 1)
@@ -140,49 +136,41 @@
assertThat(statusList[0].enrollableStatus).isEqualTo(FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusOk_isNotSuw() = runTest {
testOnStartToUpdateEnrollableStatusOk(newAllFalseRequest(application))
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusReachMax_isNotSuw() = runTest {
testOnStartToUpdateEnrollableStatusReachMax(newAllFalseRequest(application))
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusOk_isSuwDeferred() = runTest {
testOnStartToUpdateEnrollableStatusOk(newIsSuwDeferredRequest(application))
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusReachMax_isSuwDeferred() = runTest {
testOnStartToUpdateEnrollableStatusReachMax(newIsSuwDeferredRequest(application))
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusOk_isSuwPortal() = runTest {
testOnStartToUpdateEnrollableStatusOk(newIsSuwPortalRequest(application))
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusReachMax_isSuwPortal() = runTest {
testOnStartToUpdateEnrollableStatusReachMax(newIsSuwPortalRequest(application))
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusOk_isSuwSuggestedActionFlow() = runTest {
testOnStartToUpdateEnrollableStatusOk(newIsSuwSuggestedActionFlowRequest(application))
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnStartToUpdateEnrollableStatusReachMax_isSuwSuggestedActionFlow() = runTest {
testOnStartToUpdateEnrollableStatusReachMax(
@@ -190,7 +178,6 @@
)
}
- @OptIn(ExperimentalCoroutinesApi::class)
private fun TestScope.testOnStartToUpdateEnrollableStatusOk(request: EnrollmentRequest) {
setupFingerprintEnrolledFingerprints(fingerprintManager, TEST_USER_ID, 0)
val viewModel = newFingerprintEnrollIntroViewModel(
@@ -206,7 +193,6 @@
assertThat(statusList[0].enrollableStatus).isEqualTo(FINGERPRINT_ENROLLABLE_OK)
}
- @OptIn(ExperimentalCoroutinesApi::class)
private fun TestScope.testOnStartToUpdateEnrollableStatusReachMax(request: EnrollmentRequest) {
setupFingerprintEnrolledFingerprints(fingerprintManager, TEST_USER_ID, 5)
val viewModel = newFingerprintEnrollIntroViewModel(
@@ -268,7 +254,6 @@
assertThat(viewModel.isBiometricUnlockDisabledByAdmin).isEqualTo(false)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testSetHasScrolledToBottom() = runTest {
val viewModel = newFingerprintEnrollIntroViewModel(
@@ -284,7 +269,6 @@
assertThat(pageStatusList[pageStatusList.size-1].hasScrollToBottom()).isEqualTo(true)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnNextButtonClick_enrollNext() = runTest {
// Set latest status to FINGERPRINT_ENROLLABLE_OK
@@ -305,7 +289,6 @@
assertThat(actions[0]).isEqualTo(CONTINUE_ENROLL)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnNextButtonClick_doneAndFinish() = runTest {
// Set latest status to FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX
@@ -334,7 +317,6 @@
assertThat(actionList[0]).isEqualTo(DONE_AND_FINISH)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testOnSkipOrCancelButtonClick() = runTest {
val viewModel = newFingerprintEnrollIntroViewModel(
@@ -351,7 +333,6 @@
assertThat(actions[0]).isEqualTo(SKIP_OR_CANCEL)
}
- @OptIn(ExperimentalCoroutinesApi::class)
private fun TestScope.listOfActionFlow(
viewModel: FingerprintEnrollIntroViewModel
): List<FingerprintEnrollIntroAction> =
@@ -361,7 +342,6 @@
}
}
- @OptIn(ExperimentalCoroutinesApi::class)
private fun TestScope.listOfPageStatusFlow(
viewModel: FingerprintEnrollIntroViewModel
): List<FingerprintEnrollIntroStatus> =
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollmentViewModelTest.kt b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollmentViewModelTest.kt
index bee91c9..6d04f35 100644
--- a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollmentViewModelTest.kt
+++ b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollmentViewModelTest.kt
@@ -30,7 +30,6 @@
import com.android.settings.biometrics2.utils.FingerprintRepositoryUtils.newFingerprintRepository
import com.android.settings.biometrics2.utils.FingerprintRepositoryUtils.setupFingerprintEnrolledFingerprints
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.TestScope
@@ -226,7 +225,6 @@
assertThat(viewModel.isMaxEnrolledReached(uid)).isTrue()
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testSetResultFlow_defaultEmpty() = runTest {
val activityResults = listOfSetResultFlow()
@@ -236,7 +234,6 @@
assertThat(activityResults.size).isEqualTo(0)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckFinishActivityDuringOnPause_doNothingIfIsSuw() = runTest {
viewModel = FingerprintEnrollmentViewModel(
@@ -257,7 +254,6 @@
assertThat(activityResults.size).isEqualTo(0)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckFinishActivityDuringOnPause_doNothingIfIsWaitingActivity() = runTest {
val activityResults = listOfSetResultFlow()
@@ -273,7 +269,6 @@
assertThat(activityResults.size).isEqualTo(0)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckFinishActivityDuringOnPause_doNothingIfIsActivityFinishing() = runTest {
val activityResults = listOfSetResultFlow()
@@ -288,7 +283,6 @@
assertThat(activityResults.size).isEqualTo(0)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckFinishActivityDuringOnPause_doNothingIfIsChangingConfigurations() = runTest {
val activityResults = listOfSetResultFlow()
@@ -303,7 +297,6 @@
assertThat(activityResults.size).isEqualTo(0)
}
- @OptIn(ExperimentalCoroutinesApi::class)
@Test
fun testCheckFinishActivityDuringOnPause_defaultFinishSelf() = runTest {
val activityResults = listOfSetResultFlow()
@@ -320,7 +313,6 @@
assertThat(activityResults[0].data).isEqualTo(null)
}
- @OptIn(ExperimentalCoroutinesApi::class)
private fun TestScope.listOfSetResultFlow(): List<ActivityResult> =
mutableListOf<ActivityResult>().also {
backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) {