Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/android-sanity-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ jobs:
- name: Run Unit Tests
run: ./gradlew testStandardDebugUnitTest --stacktrace

# K2GO-504: BLOCKING. The merged release manifests must not get the ad permissions back and must
# start Firebase Analytics collection OFF (Play Data safety). See verifyManifestPrivacy in app/build.gradle.
- name: Verify Release Manifest Privacy
run: ./gradlew :app:verifyManifestPrivacy --stacktrace

# Lint is a BLOCKING gate for :app. The existing backlog is grandfathered via the
# committed app/lint-baseline.xml; any NEW lint error fails CI. Scoped to :app so
# the vendored termux-core/upstream backlog does not block.
Expand Down
47 changes: 42 additions & 5 deletions controller/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {

// 3. Version Control (OTA)
// NOTE: With splits enabled, this number will be multiplied by 10 (e.g. 50 -> 500, 501, 502)
versionCode 69
versionCode 70
// Dynamic version suffix: CI passes -PversionSuffix explicitly; local builds fall back to
// the git short SHA (ADFA-4787) so any installed APK is traceable to its commit.
def ciSuffix = project.hasProperty('versionSuffix') ? project.property('versionSuffix')
Expand Down Expand Up @@ -335,15 +335,12 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
// Real org.json so SyncHandshakeHelper JSON logic can run in JVM unit tests
testImplementation 'org.json:json:20231013'
// MockWebServer: JVM-level proof of the delivery HTTP contract (ADFA-4504).
// MockWebServer: JVM tests of the Kolibri tree HTTP sources (LocalTreeSource, StudioTreeSource).
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
// Drives the real OutboundSyncWorker on-device (ADFA-4504).
androidTestImplementation 'androidx.work:work-testing:2.9.1'
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
}

import groovy.json.JsonSlurper
Expand Down Expand Up @@ -605,6 +602,46 @@ tasks.register("copyHelpAssets", Sync) {
into file("src/main/assets/help")
}
tasks.matching { it.name == "preBuild" }.configureEach { dependsOn "copyHelpAssets" }

// ---- K2GO-504: release manifest privacy guard ---------------------------------
// Play held a build over its Data safety form. Firebase Analytics merges advertising permissions that
// the flavor manifests remove with tools:node="remove", and its collection must start OFF until the
// user opts in. This check fails the build when a merged release manifest gets one of these
// permissions back (a Firebase bump, a lost removal) or loses the collection flag. CI runs it.
def adPermissions = ['com.google.android.gms.permission.AD_ID',
'android.permission.ACCESS_ADSERVICES_AD_ID',
'android.permission.ACCESS_ADSERVICES_ATTRIBUTION']
def verifyManifestPrivacy = tasks.register("verifyManifestPrivacy") {
group = "verification"
description = "Fail if a merged release manifest has ad permissions or starts analytics collection ON."
}
androidComponents {
onVariants(selector().withBuildType("release")) { variant ->
def variantName = variant.name
def manifest = variant.artifacts.get(com.android.build.api.artifact.SingleArtifact.MERGED_MANIFEST.INSTANCE)
def check = tasks.register("verify${variantName.capitalize()}ManifestPrivacy") {
inputs.file(manifest)
doLast {
def root = new groovy.xml.XmlSlurper(false, false).parse(manifest.get().asFile)
def nameOf = { it.@'android:name'.text() }
def problems = root.'*'
.findAll { it.name() in ['uses-permission', 'uses-permission-sdk-23'] }
.collect(nameOf).findAll { it in adPermissions }
// Only variants that link Firebase Analytics (its measurement components) need the flag.
if (root.application.'**'.any { nameOf(it).startsWith('com.google.android.gms.measurement.') }) {
def flag = root.application.'meta-data'.find { nameOf(it) == 'firebase_analytics_collection_enabled' }
if (flag.@'android:value'.text() != 'false') {
problems << 'firebase_analytics_collection_enabled is missing or not "false"'
}
}
if (problems) {
throw new GradleException("K2GO-504: ${variantName} merged manifest: ${problems.join('; ')}")
}
}
}
verifyManifestPrivacy.configure { dependsOn check }
}
}
// ---- rootfs size auto-capture (offline fallback) ------------------------------
// Fetches the stable latest_<tier>_<abi>.meta4 <size> for each edition and writes
// src/main/assets/rootfs_sizes.csv, so the app's OFFLINE fallback (RootfsCatalog)
Expand Down

This file was deleted.

This file was deleted.

9 changes: 1 addition & 8 deletions controller/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
DEBUG-ONLY overlay: registers receivers so parts of the app can be exercised from adb
(delivery backbone, disk-guard device-verify). Merged into debug builds only; never in release.
(disk-guard device-verify). Merged into debug builds only; never in release.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<receiver
android:name="org.appdevforall.k2go.delivery.debug.DebugDeliveryReceiver"
android:exported="true">
<intent-filter>
<action android:name="org.appdevforall.k2go.DEBUG_DELIVERY" />
</intent-filter>
</receiver>
<!-- K2GO-386: adb-reachable trigger for the disk-guard device-verify (DebugDiskGuardReceiver). -->
<receiver
android:name="org.appdevforall.k2go.diskguard.debug.DebugDiskGuardReceiver"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* first filling ~58 GB. Lives in src/debug, so it never ships in release.
*
* <p>Exported (it is the whole point — an adb-reachable surface, unlike the app's non-exported
* services), mirroring {@link org.appdevforall.k2go.delivery.debug.DebugDeliveryReceiver}.
* services).
*
* <p>Two modes. The low-disk path: a huge floor makes any real free-space reading CRITICAL, tripping
* the guard for real:
Expand Down
Loading
Loading