[#972] Min API 27
This commit is contained in:
parent
9d2da8218e
commit
d513ac6559
|
@ -1,6 +1,10 @@
|
|||
Change Log
|
||||
==========
|
||||
|
||||
## 1.16.0-beta01
|
||||
### Changed
|
||||
- The minimum supported version of Android is now API level 27.
|
||||
|
||||
## 1.15.0-beta01
|
||||
### Changed
|
||||
- A new package `sdk-incubator-lib` is now available as a public API. This package contains experimental APIs that may be promoted to the SDK in the future. The APIs in this package are not guaranteed to be stable, and may change at any time.
|
||||
|
|
|
@ -104,7 +104,7 @@ fladle {
|
|||
// Firebase Test Lab has min and max values that might differ from our project's
|
||||
// These are determined by `gcloud firebase test android models list`
|
||||
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
|
||||
val FIREBASE_TEST_LAB_MIN_API = 19
|
||||
val FIREBASE_TEST_LAB_MIN_API = 27 // Minimum for Pixel2.arm device
|
||||
|
||||
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
|
||||
val FIREBASE_TEST_LAB_MAX_API = 33
|
||||
|
@ -128,7 +128,7 @@ fladle {
|
|||
}
|
||||
|
||||
devices.addAll(
|
||||
mapOf("model" to "Nexus5X", "version" to minSdkVersion),
|
||||
mapOf("model" to "Pixel2.arm", "version" to minSdkVersion),
|
||||
mapOf("model" to "Pixel2.arm", "version" to targetSdkVersion)
|
||||
)
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ fladle {
|
|||
// Firebase Test Lab has min and max values that might differ from our project's
|
||||
// These are determined by `gcloud firebase test android models list`
|
||||
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
|
||||
val FIREBASE_TEST_LAB_MIN_API = 19
|
||||
val FIREBASE_TEST_LAB_MIN_API = 27 // Minimum for Pixel2.arm device
|
||||
|
||||
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
|
||||
val FIREBASE_TEST_LAB_MAX_API = 33
|
||||
|
@ -180,7 +180,7 @@ fladle {
|
|||
testTimeout.set("5m")
|
||||
|
||||
devices.addAll(
|
||||
mapOf("model" to "Nexus5X", "version" to minSdkVersion),
|
||||
mapOf("model" to "Pixel2.arm", "version" to minSdkVersion),
|
||||
mapOf("model" to "Pixel2.arm", "version" to targetSdkVersion)
|
||||
)
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package cash.z.ecc.android.sdk.demoapp
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.StrictMode
|
||||
import cash.z.ecc.android.sdk.demoapp.util.AndroidApiVersion
|
||||
|
||||
|
@ -10,14 +8,6 @@ object StrictModeHelper {
|
|||
|
||||
fun enableStrictMode() {
|
||||
configureStrictMode()
|
||||
|
||||
// Workaround for Android bug
|
||||
// https://issuetracker.google.com/issues/36951662
|
||||
// Not needed if target O_MR1 and running on O_MR1
|
||||
// Don't really need to check target, because of Google Play enforcement on targetSdkVersion for app updates
|
||||
if (!AndroidApiVersion.isAtLeastO_MR1) {
|
||||
Handler(Looper.getMainLooper()).postAtFrontOfQueue { configureStrictMode() }
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
|
@ -31,30 +21,20 @@ object StrictModeHelper {
|
|||
}.build()
|
||||
)
|
||||
|
||||
// Don't enable missing network tags, because those are noisy.
|
||||
if (AndroidApiVersion.isAtLeastO) {
|
||||
StrictMode.setVmPolicy(
|
||||
StrictMode.VmPolicy.Builder().apply {
|
||||
detectActivityLeaks()
|
||||
detectCleartextNetwork()
|
||||
detectContentUriWithoutPermission()
|
||||
detectFileUriExposure()
|
||||
detectLeakedClosableObjects()
|
||||
detectLeakedRegistrationObjects()
|
||||
detectLeakedSqlLiteObjects()
|
||||
if (AndroidApiVersion.isAtLeastP) {
|
||||
// Disable because this is mostly flagging Android X and Play Services
|
||||
// builder.detectNonSdkApiUsage();
|
||||
}
|
||||
}.build()
|
||||
)
|
||||
} else {
|
||||
StrictMode.setVmPolicy(
|
||||
StrictMode.VmPolicy.Builder().apply {
|
||||
detectAll()
|
||||
penaltyLog()
|
||||
}.build()
|
||||
)
|
||||
}
|
||||
StrictMode.setVmPolicy(
|
||||
StrictMode.VmPolicy.Builder().apply {
|
||||
detectActivityLeaks()
|
||||
detectCleartextNetwork()
|
||||
detectContentUriWithoutPermission()
|
||||
detectFileUriExposure()
|
||||
detectLeakedClosableObjects()
|
||||
detectLeakedRegistrationObjects()
|
||||
detectLeakedSqlLiteObjects()
|
||||
if (AndroidApiVersion.isAtLeastP) {
|
||||
// Disable because this is mostly flagging Android X and Play Services
|
||||
// builder.detectNonSdkApiUsage();
|
||||
}
|
||||
}.build()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,6 @@ internal object AndroidApiVersion {
|
|||
return Build.VERSION.SDK_INT >= sdk
|
||||
}
|
||||
|
||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
|
||||
val isAtLeastO = isAtLeast(Build.VERSION_CODES.O)
|
||||
|
||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O_MR1)
|
||||
val isAtLeastO_MR1 = isAtLeast(Build.VERSION_CODES.O_MR1)
|
||||
|
||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P)
|
||||
val isAtLeastP = isAtLeast(Build.VERSION_CODES.P)
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ ZCASH_ASCII_GPG_KEY=
|
|||
# Configures whether release is an unstable snapshot, therefore published to the snapshot repository.
|
||||
IS_SNAPSHOT=true
|
||||
|
||||
LIBRARY_VERSION=1.15.0-beta01
|
||||
LIBRARY_VERSION=1.16.0-beta01
|
||||
|
||||
# Kotlin compiler warnings can be considered errors, failing the build.
|
||||
ZCASH_IS_TREAT_WARNINGS_AS_ERRORS=true
|
||||
|
@ -71,7 +71,7 @@ IS_SIGN_RELEASE_BUILD_WITH_DEBUG_KEY=false
|
|||
IS_DEBUGGABLE_WHILE_BENCHMARKING=false
|
||||
|
||||
# Versions
|
||||
ANDROID_MIN_SDK_VERSION=24
|
||||
ANDROID_MIN_SDK_VERSION=27
|
||||
ANDROID_TARGET_SDK_VERSION=33
|
||||
ANDROID_COMPILE_SDK_VERSION=33
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cash.z.ecc.android.sdk.db
|
||||
|
||||
import androidx.test.filters.SmallTest
|
||||
import cash.z.ecc.android.sdk.internal.AndroidApiVersion
|
||||
import cash.z.ecc.android.sdk.internal.db.DatabaseCoordinator
|
||||
import cash.z.ecc.android.sdk.internal.db.commonDatabaseBuilder
|
||||
import cash.z.ecc.android.sdk.internal.db.pending.PendingTransactionDb
|
||||
|
@ -30,12 +29,6 @@ class CommonDatabaseBuilderTest {
|
|||
|
||||
assertNotNull(db)
|
||||
|
||||
val expectedDbName = if (AndroidApiVersion.isAtLeastO_MR1) {
|
||||
dbFileName
|
||||
} else {
|
||||
dbFile.absolutePath
|
||||
}
|
||||
|
||||
assertEquals(expectedDbName, db.openHelper.databaseName)
|
||||
assertEquals(dbFileName, db.openHelper.databaseName)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package cash.z.ecc.android.sdk.db
|
||||
|
||||
import android.os.Build
|
||||
import androidx.test.filters.SdkSuppress
|
||||
import androidx.test.filters.SmallTest
|
||||
import cash.z.ecc.android.sdk.internal.NoBackupContextWrapper
|
||||
import cash.z.ecc.android.sdk.test.getAppContext
|
||||
|
@ -11,7 +9,6 @@ import org.junit.Assert.assertTrue
|
|||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.O_MR1)
|
||||
class NoBackupContextWrapperTest {
|
||||
|
||||
private val databaseParentDir = File(DatabasePathFixture.new())
|
||||
|
|
|
@ -15,12 +15,6 @@ internal object AndroidApiVersion {
|
|||
return Build.VERSION.SDK_INT >= sdk
|
||||
}
|
||||
|
||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
|
||||
val isAtLeastO = isAtLeast(Build.VERSION_CODES.O)
|
||||
|
||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O_MR1)
|
||||
val isAtLeastO_MR1 = isAtLeast(Build.VERSION_CODES.O_MR1)
|
||||
|
||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P)
|
||||
val isAtLeastP = isAtLeast(Build.VERSION_CODES.P)
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import androidx.room.Room
|
|||
import androidx.room.RoomDatabase
|
||||
import cash.z.ecc.android.sdk.exception.InitializeException
|
||||
import cash.z.ecc.android.sdk.ext.ZcashSdk
|
||||
import cash.z.ecc.android.sdk.internal.AndroidApiVersion
|
||||
import cash.z.ecc.android.sdk.internal.Files
|
||||
import cash.z.ecc.android.sdk.internal.LazyWithArgument
|
||||
import cash.z.ecc.android.sdk.internal.NoBackupContextWrapper
|
||||
|
@ -434,20 +433,12 @@ internal fun <T : RoomDatabase> commonDatabaseBuilder(
|
|||
klass: Class<T>,
|
||||
databaseFile: File
|
||||
): RoomDatabase.Builder<T> {
|
||||
return if (AndroidApiVersion.isAtLeastO_MR1) {
|
||||
Room.databaseBuilder(
|
||||
NoBackupContextWrapper(
|
||||
context,
|
||||
databaseFile.parentFile ?: throw InitializeException.DatabasePathException
|
||||
),
|
||||
klass,
|
||||
databaseFile.name
|
||||
)
|
||||
} else {
|
||||
Room.databaseBuilder(
|
||||
return Room.databaseBuilder(
|
||||
NoBackupContextWrapper(
|
||||
context,
|
||||
klass,
|
||||
databaseFile.absolutePath
|
||||
)
|
||||
}
|
||||
databaseFile.parentFile ?: throw InitializeException.DatabasePathException
|
||||
),
|
||||
klass,
|
||||
databaseFile.name
|
||||
)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||
import androidx.sqlite.db.SupportSQLiteOpenHelper
|
||||
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
|
||||
import cash.z.ecc.android.sdk.exception.InitializeException
|
||||
import cash.z.ecc.android.sdk.internal.AndroidApiVersion
|
||||
import cash.z.ecc.android.sdk.internal.NoBackupContextWrapper
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
@ -27,23 +26,15 @@ object ReadOnlySupportSqliteOpenHelper {
|
|||
databaseVersion: Int
|
||||
): SupportSQLiteDatabase {
|
||||
return withContext(Dispatchers.IO) {
|
||||
val config = if (AndroidApiVersion.isAtLeastO_MR1) {
|
||||
val contextWrapper = NoBackupContextWrapper(
|
||||
context,
|
||||
file.parentFile ?: throw InitializeException.DatabasePathException
|
||||
)
|
||||
SupportSQLiteOpenHelper.Configuration.builder(contextWrapper)
|
||||
.apply {
|
||||
name(file.name)
|
||||
callback(ReadOnlyCallback(databaseVersion))
|
||||
}.build()
|
||||
} else {
|
||||
SupportSQLiteOpenHelper.Configuration.builder(context)
|
||||
.apply {
|
||||
name(file.absolutePath)
|
||||
callback(ReadOnlyCallback(databaseVersion))
|
||||
}.build()
|
||||
}
|
||||
val contextWrapper = NoBackupContextWrapper(
|
||||
context,
|
||||
file.parentFile ?: throw InitializeException.DatabasePathException
|
||||
)
|
||||
val config = SupportSQLiteOpenHelper.Configuration.builder(contextWrapper)
|
||||
.apply {
|
||||
name(file.name)
|
||||
callback(ReadOnlyCallback(databaseVersion))
|
||||
}.build()
|
||||
|
||||
FrameworkSQLiteOpenHelperFactory().create(config).readableDatabase
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue