- Decision
- ADR-033
- Date
- 2026-08-06
- Status
- SupersededSuperseded by ADR-240. Accepted
- Mentions
- ADR-032, ADR-240
- Mentioned by
- ADR-051, ADR-240
1Decision
Accept that Guardian's REVOKE_BACKGROUND_LOCATION remediation is now real, working, and independently verified end-to-end on the Phase 1 emulator baseline — a real privileged app (GuardianApp, certificate: "platform", privileged: true), not a design document or unit test.
2Why and evidence
Task 8 of the Guardian platform integration plan booted the real sdk_phone64_x86_64-cp2a-userdebug image built in Task 7 (same emulator baseline as docs/reviews/phase-1-emulator-baseline-review.md) and ran the full detect -> approve -> verify -> Undo cycle against it, cross-checking every result against adb shell dumpsys package rather than trusting the app's own UI or logs (docs/quality/validation-matrix.md's new GBL-001..GBL-006 rows).
This superseded two provisional names/assumptions from earlier design/planning text with what was actually confirmed working: ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND (not the nonexistent RUNNING_APP_PROCESS_INFO_IMPORTANCE_FOREGROUND the Task 4 brief had used, caught by Task 7's real javac failure), and PackageManager.checkPermission(String, String) / revokeRuntimePermission / grantRuntimePermission against arbitrary target packages, which is real and correct but requires android.permission.QUERY_ALL_PACKAGES (protectionLevel="normal", frameworks/base/core/res/AndroidManifest.xml:9284-9291) — found only by running the real pipeline: AegisOSPlatformGateway.snapshot() was silently returning granted=false for a permission dumpsys independently confirmed was granted=true, because Android's API 30+ package-visibility filtering hides a non-platform-signed target app's state from a caller with no <queries>/visibility grant, with no exception thrown to signal the failure.
Root-caused via superpowers:systematic-debugging, presented to the owner with the narrower <queries>-allowlist alternative explicitly and rejected as insufficient (Guardian must observe arbitrary third-party apps by design, not a fixed enumerable set), approved 2026-08-06.
A second real, independent gap found and fixed the same session: GuardianWatcherService was never actually running — android:persistent="true" keeps the process alive but starts no Service on its own, and the Task 5/6 controller-designed trigger flow had silently dropped the "start the watcher" step the original plan text implied; fixed by starting it from GuardianApplication.onCreate().
3Consequences
docs/security/capability-boundaries.md's Guardian remediation row now names QUERY_ALL_PACKAGES, scoped explicitly to permission-state checks on the registered action's own target app, not package-content/install/usage-data access.
Guardian's real installed permission set on the built image was independently confirmed (GBL-006) to match exactly six permissions — WATCH_APPOPS, GET_APP_OPS_STATS, REVOKE_RUNTIME_PERMISSIONS, GRANT_RUNTIME_PERMISSIONS, PACKAGE_USAGE_STATS (ADR-032), QUERY_ALL_PACKAGES (this entry) — plus only the standard Android-generated DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION, no extra or missing entries.
The fail-closed verify/rollback design was proven against real behavior, not just code review: a deliberate, temporary, never-committed fault injection in apply() (skipping the real revoke call while still reporting success) was rebuilt, run, and confirmed to produce an honest failure/rollback UI state with the permission provably untouched throughout (GBL-004), then fully reverted before any further work.
guardian/app/tests/test_revoke_background_location.sh is corrected to actually simulate the required "Protect app" tap (it previously only waited passively, which would report FAIL even when detection worked correctly, since Guardian never auto-remediates by design). Guardian remains emulator-only; no physical lynx validation of this feature has occurred.
4Review when
Before BLOCK_BACKGROUND_NETWORK, REMOVE_OVERLAY_PERMISSION, or FREEZE_APPLICATION are proposed for the same real-build-and-validate treatment (each will need its own AOSP API and permission verification cycle, not an assumption that this entry's findings generalize); or before physical lynx hardware validation of any Guardian remediation action is proposed.
Read from docs/governance/decision-log.md, entry ADR-033.