Merge pull request #742 from theimpulson/a15

Android 15 updates
This commit is contained in:
Torsten Grote 2024-09-12 09:17:31 -03:00 committed by GitHub
commit fa56a74ad7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 50 additions and 41 deletions

Binary file not shown.

Binary file not shown.

View file

@ -57,6 +57,7 @@ import kotlin.random.Random
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
@Config( @Config(
sdk = [34], // TODO: Drop once robolectric supports 35
application = TestApp::class application = TestApp::class
) )
class MetadataManagerTest { class MetadataManagerTest {
@ -342,7 +343,7 @@ class MetadataManagerTest {
@Test @Test
fun `test onPackageBackedUp()`() { fun `test onPackageBackedUp()`() {
packageInfo.applicationInfo.flags = FLAG_SYSTEM packageInfo.applicationInfo!!.flags = FLAG_SYSTEM
val updatedMetadata = initialMetadata.copy( val updatedMetadata = initialMetadata.copy(
time = time, time = time,
packageMetadataMap = PackageMetadataMap() // otherwise this isn't copied, but referenced packageMetadataMap = PackageMetadataMap() // otherwise this isn't copied, but referenced

View file

@ -24,6 +24,7 @@ import org.robolectric.annotation.Config
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
@Config( @Config(
sdk = [34], // TODO: Drop once robolectric supports 35
application = TestApp::class application = TestApp::class
) )
internal class DocumentFileTest { internal class DocumentFileTest {

View file

@ -28,6 +28,7 @@ import kotlin.random.Random
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
@Config( @Config(
sdk = [34], // TODO: Drop once robolectric supports 35
application = TestApp::class application = TestApp::class
) )
internal class WebDavStoragePluginTest : TransportTest() { internal class WebDavStoragePluginTest : TransportTest() {

View file

@ -35,12 +35,16 @@ import org.junit.jupiter.api.Assertions.assertNull
import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Assertions.fail
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.robolectric.annotation.Config
import java.io.ByteArrayInputStream import java.io.ByteArrayInputStream
import java.io.IOException import java.io.IOException
import kotlin.random.Random import kotlin.random.Random
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
@OptIn(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
@Config(
sdk = [34] // TODO: Drop once robolectric supports 35
)
internal class AppSelectionManagerTest : TransportTest() { internal class AppSelectionManagerTest : TransportTest() {
private val storagePluginManager: StoragePluginManager = mockk() private val storagePluginManager: StoragePluginManager = mockk()

View file

@ -118,12 +118,12 @@ internal class ApkBackupRestoreTest : TransportTest() {
fun `test backup and restore with a split`(@TempDir tmpDir: Path) = runBlocking { fun `test backup and restore with a split`(@TempDir tmpDir: Path) = runBlocking {
val apkBytes = byteArrayOf(0x04, 0x05, 0x06) val apkBytes = byteArrayOf(0x04, 0x05, 0x06)
val tmpFile = File(tmpDir.toAbsolutePath().toString()) val tmpFile = File(tmpDir.toAbsolutePath().toString())
packageInfo.applicationInfo.sourceDir = File(tmpFile, "test.apk").apply { packageInfo.applicationInfo!!.sourceDir = File(tmpFile, "test.apk").apply {
assertTrue(createNewFile()) assertTrue(createNewFile())
writeBytes(apkBytes) writeBytes(apkBytes)
}.absolutePath }.absolutePath
packageInfo.splitNames = arrayOf(splitName) packageInfo.splitNames = arrayOf(splitName)
packageInfo.applicationInfo.splitSourceDirs = arrayOf(File(tmpFile, "split.apk").apply { packageInfo.applicationInfo!!.splitSourceDirs = arrayOf(File(tmpFile, "split.apk").apply {
assertTrue(createNewFile()) assertTrue(createNewFile())
writeBytes(splitBytes) writeBytes(splitBytes)
}.absolutePath) }.absolutePath)
@ -167,7 +167,7 @@ internal class ApkBackupRestoreTest : TransportTest() {
coEvery { storagePlugin.getInputStream(token, name) } returns inputStream coEvery { storagePlugin.getInputStream(token, name) } returns inputStream
every { pm.getPackageArchiveInfo(capture(apkPath), any<Int>()) } returns packageInfo every { pm.getPackageArchiveInfo(capture(apkPath), any<Int>()) } returns packageInfo
every { applicationInfo.loadIcon(pm) } returns icon every { applicationInfo.loadIcon(pm) } returns icon
every { pm.getApplicationLabel(packageInfo.applicationInfo) } returns appName every { pm.getApplicationLabel(packageInfo.applicationInfo!!) } returns appName
every { every {
splitCompatChecker.isCompatible(metadata.deviceName, listOf(splitName)) splitCompatChecker.isCompatible(metadata.deviceName, listOf(splitName))
} returns true } returns true

View file

@ -281,7 +281,7 @@ internal class ApkRestoreTest : TransportTest() {
} returns apkInputStream } returns apkInputStream
every { pm.getPackageArchiveInfo(any(), any<Int>()) } returns packageInfo every { pm.getPackageArchiveInfo(any(), any<Int>()) } returns packageInfo
every { applicationInfo.loadIcon(pm) } returns icon every { applicationInfo.loadIcon(pm) } returns icon
every { pm.getApplicationLabel(packageInfo.applicationInfo) } returns appName every { pm.getApplicationLabel(packageInfo.applicationInfo!!) } returns appName
coEvery { coEvery {
apkInstaller.install(match { it.size == 1 }, packageName, installerName, any()) apkInstaller.install(match { it.size == 1 }, packageName, installerName, any())
} returns installResult } returns installResult
@ -706,7 +706,7 @@ internal class ApkRestoreTest : TransportTest() {
coEvery { storagePlugin.getInputStream(token, name) } returns apkInputStream coEvery { storagePlugin.getInputStream(token, name) } returns apkInputStream
every { pm.getPackageArchiveInfo(any(), any<Int>()) } returns packageInfo every { pm.getPackageArchiveInfo(any(), any<Int>()) } returns packageInfo
every { applicationInfo.loadIcon(pm) } returns icon every { applicationInfo.loadIcon(pm) } returns icon
every { pm.getApplicationLabel(packageInfo.applicationInfo) } returns appName every { pm.getApplicationLabel(packageInfo.applicationInfo!!) } returns appName
} }
private suspend fun TurbineTestContext<InstallResult>.assertQueuedFailFinished() { private suspend fun TurbineTestContext<InstallResult>.assertQueuedFailFinished() {

View file

@ -27,6 +27,7 @@ import kotlin.random.Random
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
@Config( @Config(
sdk = [34], // TODO: Drop once robolectric supports 35
application = TestApp::class application = TestApp::class
) )
internal class DeviceInfoTest { internal class DeviceInfoTest {

View file

@ -82,7 +82,7 @@ internal class ApkBackupTest : BackupTest() {
@Test @Test
fun `does not back up test-only apps`() = runBlocking { fun `does not back up test-only apps`() = runBlocking {
packageInfo.applicationInfo.flags = FLAG_TEST_ONLY packageInfo.applicationInfo!!.flags = FLAG_TEST_ONLY
every { settingsManager.isBackupEnabled(any()) } returns true every { settingsManager.isBackupEnabled(any()) } returns true
every { settingsManager.backupApks() } returns true every { settingsManager.backupApks() } returns true
@ -91,7 +91,7 @@ internal class ApkBackupTest : BackupTest() {
@Test @Test
fun `does not back up system apps`() = runBlocking { fun `does not back up system apps`() = runBlocking {
packageInfo.applicationInfo.flags = FLAG_SYSTEM packageInfo.applicationInfo!!.flags = FLAG_SYSTEM
every { settingsManager.isBackupEnabled(any()) } returns true every { settingsManager.isBackupEnabled(any()) } returns true
every { settingsManager.backupApks() } returns true every { settingsManager.backupApks() } returns true
@ -100,7 +100,7 @@ internal class ApkBackupTest : BackupTest() {
@Test @Test
fun `does not back up the same version`() = runBlocking { fun `does not back up the same version`() = runBlocking {
packageInfo.applicationInfo.flags = FLAG_UPDATED_SYSTEM_APP packageInfo.applicationInfo!!.flags = FLAG_UPDATED_SYSTEM_APP
val packageMetadata = packageMetadata.copy( val packageMetadata = packageMetadata.copy(
version = packageInfo.longVersionCode version = packageInfo.longVersionCode
) )
@ -112,7 +112,7 @@ internal class ApkBackupTest : BackupTest() {
@Test @Test
fun `does back up the same version when signatures changes`() { fun `does back up the same version when signatures changes`() {
packageInfo.applicationInfo.sourceDir = "/tmp/doesNotExist" packageInfo.applicationInfo!!.sourceDir = "/tmp/doesNotExist"
expectChecks() expectChecks()
@ -140,7 +140,7 @@ internal class ApkBackupTest : BackupTest() {
fun `test successful APK backup`(@TempDir tmpDir: Path) = runBlocking { fun `test successful APK backup`(@TempDir tmpDir: Path) = runBlocking {
val apkBytes = byteArrayOf(0x04, 0x05, 0x06) val apkBytes = byteArrayOf(0x04, 0x05, 0x06)
val tmpFile = File(tmpDir.toAbsolutePath().toString()) val tmpFile = File(tmpDir.toAbsolutePath().toString())
packageInfo.applicationInfo.sourceDir = File(tmpFile, "test.apk").apply { packageInfo.applicationInfo!!.sourceDir = File(tmpFile, "test.apk").apply {
assertTrue(createNewFile()) assertTrue(createNewFile())
writeBytes(apkBytes) writeBytes(apkBytes)
}.absolutePath }.absolutePath
@ -174,7 +174,7 @@ internal class ApkBackupTest : BackupTest() {
// create base APK // create base APK
val apkBytes = byteArrayOf(0x04, 0x05, 0x06) // not random because of hash val apkBytes = byteArrayOf(0x04, 0x05, 0x06) // not random because of hash
val tmpFile = File(tmpDir.toAbsolutePath().toString()) val tmpFile = File(tmpDir.toAbsolutePath().toString())
packageInfo.applicationInfo.sourceDir = File(tmpFile, "test.apk").apply { packageInfo.applicationInfo!!.sourceDir = File(tmpFile, "test.apk").apply {
assertTrue(createNewFile()) assertTrue(createNewFile())
writeBytes(apkBytes) writeBytes(apkBytes)
}.absolutePath }.absolutePath
@ -187,7 +187,7 @@ internal class ApkBackupTest : BackupTest() {
val split1Sha256 = "ZqZ1cVH47lXbEncWx-Pc4L6AdLZOIO2lQuXB5GypxB4" val split1Sha256 = "ZqZ1cVH47lXbEncWx-Pc4L6AdLZOIO2lQuXB5GypxB4"
val split2Bytes = byteArrayOf(0x01, 0x02, 0x03) val split2Bytes = byteArrayOf(0x01, 0x02, 0x03)
val split2Sha256 = "A5BYxvLAy0ksUzsKTRTvd8wPeKvMztUofYShogEc-4E" val split2Sha256 = "A5BYxvLAy0ksUzsKTRTvd8wPeKvMztUofYShogEc-4E"
packageInfo.applicationInfo.splitSourceDirs = arrayOf( packageInfo.applicationInfo!!.splitSourceDirs = arrayOf(
File(tmpFile, "test-$split1Name.apk").apply { File(tmpFile, "test-$split1Name.apk").apply {
assertTrue(createNewFile()) assertTrue(createNewFile())
writeBytes(split1Bytes) writeBytes(split1Bytes)

View file

@ -5,14 +5,14 @@
[versions] [versions]
# Gradle plugin versions # Gradle plugin versions
androidGradlePlugin = "8.5.1" androidGradlePlugin = "8.6.0"
protobufPlugin = "0.9.4" protobufPlugin = "0.9.4"
ktlint = "11.5.0" ktlint = "11.5.0"
# Android SDK versions # Android SDK versions
compileSdk = "34" compileSdk = "35"
minSdk = "34" minSdk = "34"
targetSdk = "34" targetSdk = "35"
# Test versions # Test versions
junit4 = "4.13.2" junit4 = "4.13.2"
@ -31,47 +31,48 @@ espresso = "3.4.0"
# 1.8.10 Android 14 # 1.8.10 Android 14
# 1.9.0 Android 14 (QPR2) # 1.9.0 Android 14 (QPR2)
# 1.9.22 Android 14 (QPR3) # 1.9.22 Android 14 (QPR3)
# Check: https://android.googlesource.com/platform/external/kotlinc/+/refs/tags/android-14.0.0_r53/build.txt # 1.9.23 Android 15
kotlin = { strictly = "1.9.22" } # Check: https://android.googlesource.com/platform/external/kotlinc/+/refs/tags/android-15.0.0_r1/build.txt
ksp = "1.9.22-1.0.17" # Keep in match with kotlin version kotlin = { strictly = "1.9.23" }
ksp = "1.9.23-1.0.20" # Keep in match with kotlin version
dokka = "1.9.20" # Dokka has no releases after 1.9.20 dokka = "1.9.20" # Dokka has no releases after 1.9.20
# Lint versions # Lint versions
lint-rules = { strictly = "0.1.0" } lint-rules = { strictly = "0.1.0" }
# Google versions # Google versions
# https://android.googlesource.com/platform/external/protobuf/+/refs/tags/android-14.0.0_r53/java/pom.xml#7 # https://android.googlesource.com/platform/external/protobuf/+/refs/tags/android-15.0.0_r1/java/pom.xml#7
protobuf = { strictly = "3.21.12" } protobuf = { strictly = "3.21.12" }
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-14.0.0_r53/current/extras/material-design-x/Android.bp#15 # https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-15.0.0_r1/current/extras/material-design-x/Android.bp#7
material = { strictly = "1.7.0-alpha03" } material = { strictly = "1.11.0" }
# careful with upgrading tink, so old backups continue to be decryptable # careful with upgrading tink, so old backups continue to be decryptable
# https://github.com/tink-crypto/tink-java/releases # https://github.com/tink-crypto/tink-java/releases
tink = { strictly = "1.10.0" } tink = { strictly = "1.10.0" }
# Coroutines versions # Coroutines versions
# https://android.googlesource.com/platform/external/kotlinx.coroutines/+/refs/tags/android-14.0.0_r53/CHANGES.md # https://android.googlesource.com/platform/external/kotlinx.coroutines/+/refs/tags/android-15.0.0_r1/CHANGES.md
coroutines = { strictly = "1.7.3" } # AOSP has 1.7.2 but several libs require 1.7.3 coroutines = { strictly = "1.7.3" } # AOSP has 1.7.2 but several libs require 1.7.3
# AndroidX versions # AndroidX versions
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/room/room-ktx?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-15.0.0_r1/current/androidx/m2repository/androidx/room/room-ktx?autodive=0
room = { strictly = "2.7.0-alpha01" } room = { strictly = "2.7.0-alpha03" }
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/core/core-ktx?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-15.0.0_r1/current/androidx/m2repository/androidx/core/core-ktx?autodive=0
androidx-core = { strictly = "1.13.0-beta01" } androidx-core = { strictly = "1.14.0-alpha01" }
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/fragment/fragment-ktx?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-15.0.0_r1/current/androidx/m2repository/androidx/fragment/fragment-ktx?autodive=0
androidx-fragment = { strictly = "1.7.0-beta01" } androidx-fragment = { strictly = "1.8.0-rc01" }
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/activity/activity-ktx?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-15.0.0_r1/current/androidx/m2repository/androidx/activity/activity-ktx?autodive=0
androidx-activity = { strictly = "1.9.0-alpha03" } androidx-activity = { strictly = "1.9.2" } # 1.10.0-alpha01 in AOSP but has compile SDK version issues
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r29/current/androidx/m2repository/androidx/preference/preference?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r29/current/androidx/m2repository/androidx/preference/preference?autodive=0
androidx-preference = { strictly = "1.2.0-alpha01" } # 1.3.0-alpha01 in AOSP but isn't released androidx-preference = { strictly = "1.2.0-alpha01" } # 1.3.0-alpha01 in AOSP but isn't released
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/lifecycle/lifecycle-viewmodel-ktx?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-15.0.0_r1/current/androidx/m2repository/androidx/lifecycle/lifecycle-viewmodel-ktx?autodive=0
androidx-lifecycle-viewmodel-ktx = { strictly = "2.8.0-alpha02" } androidx-lifecycle-viewmodel-ktx = { strictly = "2.9.0-alpha01" }
androidx-lifecycle-livedata-ktx = { strictly = "2.8.0-alpha02" } androidx-lifecycle-livedata-ktx = { strictly = "2.9.0-alpha01" }
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/constraintlayout/constraintlayout?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-15.0.0_r1/current/androidx/m2repository/androidx/constraintlayout/constraintlayout?autodive=0
androidx-constraintlayout = { strictly = "2.2.0-alpha13" } androidx-constraintlayout = { strictly = "2.2.0-alpha13" }
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/documentfile/documentfile?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-15.0.0_r1/current/androidx/m2repository/androidx/documentfile/documentfile?autodive=0
androidx-documentfile = { strictly = "1.1.0-alpha01" } # 1.1.0-alpha02 in AOSP but isn't released androidx-documentfile = { strictly = "1.1.0-alpha01" } # 1.1.0-alpha02 in AOSP but isn't released
# https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/work/work-runtime-ktx?autodive=0 # https://android.googlesource.com/platform/prebuilts/sdk/+/android-15.0.0_r1/current/androidx/m2repository/androidx/work/work-runtime-ktx?autodive=0
androidx-work-runtime = { strictly = "2.10.0-alpha01" } androidx-work-runtime = { strictly = "2.10.0-alpha02" }
[libraries] [libraries]
# Kotlin standard dependencies # Kotlin standard dependencies

Binary file not shown.

View file

@ -1,8 +1,8 @@
#Thu May 30 09:49:42 IST 2024 #Mon Sep 09 11:23:59 IST 2024
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab distributionSha256Sum=5b9c5eb3f9fc2c94abaea57d90bd78747ca117ddbbf96c859d3741181a12bf2a
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME