Files
internet_use_control/android/app/build.gradle.kts
Sam Rolfe e018c3bfa8 Phase 5.1: kids' Android client (Accessibility block overlay + tamper alert)
Add android/, a normal Gradle/Kotlin project with its own wrapper. It
blocks by interruption: an Accessibility Service watches the foreground
package and a full-screen overlay covers any listed app while the device
is locked (FR-16). No Device Owner, no factory reset, no managed profile.

The client subscribes to the retained restrict/<device>/config topic on
the 8883 TLS plane, keeps the last config on disk so a broker-less device
keeps its rules (FR-14), and reports tampering on its own status topic
(FR-17): a disabled service, a revoked overlay permission, or a
force-stop seen on the next start. The Control Service now parses the
tamper field and raises an Apprise alert, so it reaches Sam.

The block path and the tamper alert are proven on the headless pixel35
emulator on .27; see android/README.md and android/tools/emu-proof.sh.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-13 20:17:22 +11:00

72 lines
2.3 KiB
Kotlin

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "au.audasmedia.webrestrict.kids"
compileSdk = 35
defaultConfig {
applicationId = "au.audasmedia.webrestrict.kids"
minSdk = 26
targetSdk = 35
versionCode = 1
versionName = "0.1.0-phase5.1"
// The emulator default: a device config with the Settings app blocked.
// A real device receives the retained config over MQTT and overwrites
// this, but a broker-less device must still block (FR-14).
buildConfigField("String", "DEFAULT_DEVICE_TOPIC", "\"restrict/harry_phone_1/config\"")
buildConfigField("String", "DEFAULT_DEVICE_NAME", "\"Harry's phone\"")
buildConfigField("String", "DEFAULT_BROKER_HOST", "\"192.168.20.13\"")
buildConfigField("int", "DEFAULT_BROKER_PORT", "8883")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
debug {
// The headless emulator proof installs the debug build. Keep the
// application id identical to release so the adb commands that
// enable the Accessibility Service stay simple.
versionNameSuffix = "-debug"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {
buildConfig = true
viewBinding = false
}
packaging {
resources.excludes += setOf("META-INF/*.kotlin_module")
}
}
dependencies {
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.appcompat:appcompat:1.7.0")
// MQTT over TLS on the 8883 plane (AGENTS.md §10 rule 6). The Java client is
// pure JVM, so it also runs under the unit tests.
implementation("org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5")
// JSON is identical on Android and on the JVM, so Config parsing is unit
// tested without Robolectric.
implementation("com.google.code.gson:gson:2.11.0")
testImplementation("junit:junit:4.13.2")
}