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>
This commit is contained in:
@@ -75,6 +75,10 @@ type Options struct {
|
||||
Source ConfigSource
|
||||
// Reports is required to store device reports.
|
||||
Reports ReportSink
|
||||
// OnTamper, when set, is called for every status payload that carries a
|
||||
// tamper report (FR-17). It runs on the broker's callback goroutine, so it
|
||||
// must return quickly; the service uses it to raise one Apprise alert.
|
||||
OnTamper func(ctx context.Context, dev store.Device, tamper Tamper)
|
||||
// OnConnected runs after every successful (re)connect. The service uses it
|
||||
// to republish every device's retained config.
|
||||
OnConnected func()
|
||||
@@ -280,6 +284,15 @@ func (l *Link) handleStatusMessage(_ paho.Client, msg paho.Message) {
|
||||
l.log.Info("presence changed", "device", dev.Name, "topic", msg.Topic(),
|
||||
"online", online, "retained", msg.Retained())
|
||||
}
|
||||
|
||||
if status.HasTamper() {
|
||||
t := *status.Tamper
|
||||
l.log.Warn("device tamper reported", "device", dev.Name, "topic", msg.Topic(),
|
||||
"kind", t.Kind, "detail", t.Detail)
|
||||
if l.opts.OnTamper != nil {
|
||||
l.opts.OnTamper(ctx, *dev, t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handleTelemetryMessage stores a device usage report.
|
||||
|
||||
Reference in New Issue
Block a user