No need to use @SuppressLint("NewApi") when @ChecksSdkIntAtLeast is used.

This commit is contained in:
Benoit Marty 2022-09-16 17:50:17 +02:00 committed by Benoit Marty
parent 5886245bbf
commit 658a09ea6a
2 changed files with 4 additions and 2 deletions

View File

@ -34,4 +34,7 @@ interface BuildVersionSdkIntProvider {
result() result()
} else null } else null
} }
@ChecksSdkIntAtLeast(parameter = 0)
fun isAtLeast(version: Int) = get() >= version
} }

View File

@ -36,14 +36,13 @@ class LockScreenKeysMigrator @Inject constructor(
/** /**
* Performs any needed migrations in order. * Performs any needed migrations in order.
*/ */
@SuppressLint("NewApi")
suspend fun migrateIfNeeded() { suspend fun migrateIfNeeded() {
if (legacyPinCodeMigrator.isMigrationNeeded()) { if (legacyPinCodeMigrator.isMigrationNeeded()) {
legacyPinCodeMigrator.migrate() legacyPinCodeMigrator.migrate()
missingSystemKeyMigrator.migrateIfNeeded() missingSystemKeyMigrator.migrateIfNeeded()
} }
if (systemKeyV1Migrator.isMigrationNeeded() && versionProvider.get() >= Build.VERSION_CODES.M) { if (systemKeyV1Migrator.isMigrationNeeded() && versionProvider.isAtLeast(Build.VERSION_CODES.M)) {
systemKeyV1Migrator.migrate() systemKeyV1Migrator.migrate()
} }
} }