appstore: advertise split-set base instead of ABI config split (#844)
- Commit
632bf0fde25a78fcfdfba900a51d3090a9b77198- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-05 18:51 UTC (1 month ago)
- Parents
d612078
When the proprietary mirror lists a release as a base plus its config splits under one versionCode, the splits carry no requiredSplitTypes of their own. The ABI config split (e.g. *-config.arm64_v8a.apk) then outranked its own universal base on ABI fit and was advertised as the installable APK. Hash and signer checks passed — they come from that same entry — and Android refused the session at commit time with STATUS_FAILURE_INCOMPATIBLE, surfacing as "couldn't install [app]: it isn't built for this device" on arm64 phones like the Pixel 8a. selectVersion now treats any entry sharing a versionCode with a base as a sibling: installed alongside the base, never instead of it. Monolithic releases and per-architecture variants (F-Droid) are unaffected — the filter only activates for versionCodes that name a split-set release. Simulated the fixed selection against the live proprietary index: all 178 packages now advertise a base or monolithic APK, zero config-split winners (was 150 of 178). Added two regression tests. Verification: :appstore:compileDevKotlin clean, targeted unit tests (FDroidVersionSelectionTest, CachedAppSplitFilesTest) pass.
Diff
appstore/src/main/java/com/vayunmathur/appstore/data/FDroidRepository.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/data/FDroidRepository.kt b/appstore/src/main/java/com/vayunmathur/appstore/data/FDroidRepository.ktindex f7f18657da..c82484260f 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/data/FDroidRepository.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/data/FDroidRepository.kt@@ -594,16 +594,32 @@ object FDroidRepository { * has no build for this architecture falls back to an older one that does rather than * disappearing. *- * A split-set base wins ties against its own siblings: GMS's mirror entry carries the- * base plus config splits plus runtime Dynamite modules (`*_installtime.apk`) under one- * versionCode, all ABI-matching. The non-empty `requiredSplitTypes` marks the base — the- * only file installable standalone — so a module can never win on hash order again.+ * A non-base entry of a split-set release is never advertised: the proprietary mirror+ * lists each release as a base plus its config splits under one versionCode, and the+ * splits carry no `requiredSplitTypes` of their own, so a device-ABI config split+ * (e.g. `*-config.arm64_v8a.apk`) used to outrank its own universal base on ABI fit+ * and get advertised as the installable APK. The hash and signer checks then passed —+ * they come from that same entry — and Android refused the session at commit time+ * with STATUS_FAILURE_INCOMPATIBLE ("couldn't install X: it isn't built for this+ * device", issue #844). Any entry sharing a versionCode with a base is a sibling,+ * installed alongside the base, never instead of it.+ *+ * A split-set base still wins ties against its own siblings: GMS's mirror entry carries+ * the base plus config splits plus runtime Dynamite modules (`*_installtime.apk`) under+ * one versionCode, all ABI-matching. The non-empty `requiredSplitTypes` marks the base —+ * the only file installable standalone — so a module can never win on hash order again. */ internal fun selectVersion( candidates: List<VersionCandidate>, deviceAbis: List<String>,- ): VersionCandidate? =- candidates+ ): VersionCandidate? {+ // VersionCodes that name a split-set release: anything sharing one without+ // carrying split types of its own is a config split, not an installable APK.+ val splitSetCodes = candidates+ .filter { it.requiredSplitTypes.isNotEmpty() }+ .mapTo(mutableSetOf()) { it.versionCode }+ return candidates+ .filter { it.requiredSplitTypes.isNotEmpty() || it.versionCode !in splitSetCodes } .mapNotNull { candidate -> abiRank(candidate.nativeCode, deviceAbis)?.let { candidate to it } } .minWithOrNull( compareByDescending<Pair<VersionCandidate, Int>> { it.first.added }@@ -613,6 +629,7 @@ object FDroidRepository { .thenByDescending { it.first.size } ) ?.first+ } /** * How well an APK's `nativecode` fits this device — lower is better, null means it cannot
appstore/src/test/java/com/vayunmathur/appstore/data/FDroidVersionSelectionTest.kt
diff --git a/appstore/src/test/java/com/vayunmathur/appstore/data/FDroidVersionSelectionTest.kt b/appstore/src/test/java/com/vayunmathur/appstore/data/FDroidVersionSelectionTest.ktindex c4662a45bf..b4271e46a5 100644--- a/appstore/src/test/java/com/vayunmathur/appstore/data/FDroidVersionSelectionTest.kt+++ b/appstore/src/test/java/com/vayunmathur/appstore/data/FDroidVersionSelectionTest.kt@@ -143,6 +143,32 @@ class FDroidVersionSelectionTest { assertEquals("/app_big.apk", FDroidRepository.selectVersion(release, arm64Device)?.fileName) } + @Test+ fun `never advertises a config split of a split-set release`() {+ // Proprietary mirror (issue #844): each release is a universal base plus its+ // config splits under one versionCode, and the splits carry no+ // requiredSplitTypes of their own. The ABI config split outranked its own+ // base on ABI fit and was advertised as the installable APK; the OS then+ // refused the session ("couldn't install X: it isn't built for this device").+ val release = listOf(+ version(200, "/app-12-config.arm64_v8a.apk", versionCode = 12, nativeCode = listOf("arm64-v8a")),+ version(200, "/app-12.apk", versionCode = 12, requiredSplitTypes = listOf("base__abi", "base__density"), size = 100_000_000L),+ version(200, "/app-12-config.xxhdpi.apk", versionCode = 12),+ )++ assertEquals("/app-12.apk", FDroidRepository.selectVersion(release, arm64Device)?.fileName)+ }++ @Test+ fun `monolithic releases are unaffected by the split-set filter`() {+ val release = listOf(+ version(200, "/app-12.apk", versionCode = 12, nativeCode = listOf("arm64-v8a")),+ version(100, "/app-11.apk", versionCode = 11, nativeCode = listOf("arm64-v8a")),+ )++ assertEquals("/app-12.apk", FDroidRepository.selectVersion(release, arm64Device)?.fileName)+ }+ @Test fun `identifies Dynamite runtime modules by the installtime infix`() { assertEquals(true, FDroidRepository.isDynamiteModule("/gms/264230035/gms-264230035-CronetDynamite_installtime.apk"))