- Decision
- ADR-073
- Date
- 2026-09-03
- Status
- AcceptedAccepted
- Part
- Duress Unlock
- Mentions
- ADR-021, ADR-065, ADR-072
- Mentioned by
- ADR-079, ADR-083
1Decision
Find, root-cause, fix, and hardware-verify a real crash-to-full-device-reboot bug in the Duress Unlock decoy-switch mechanism, discovered while attempting ADR-072's own dynamic validation.
2Why and evidence
While validating ADR-072's candidate, entering the decoy PIN on a device that had already fully booted and settled — but where the real owner's own credential had never been entered this boot — caused system_server to crash fatally and the whole device to reboot, dropping the just-established decoy session and landing back on user 0's lockscreen.
This is arguably the single most realistic real-world coercion scenario Duress Unlock exists for (a freshly-booted, never-yet-unlocked phone), and it broke.
Root-caused via the device's own event log (uc_finish_user_unlocking/ssm_user_unlocking firing for user 10, the decoy, never 0, immediately before the crash — ruling out DecoyProfileHelper/RealUserQuiescer, neither of which calls anything backup- or unlock-lifecycle-related) down to one exact line: frameworks/base/services/backup/java/com/android/server/backup/UserBackupManagerService.java:622 passed mContext (the un-scoped, implicitly-user-0 construction-time context) instead of userContext (created six lines above it, for exactly this purpose, with the comment "We need a context for the user in question") to UserBackupPreferences's constructor, so its getSharedPreferences()/credentialProtectedStorageCheck() call always checked user 0's CE-storage-unlocked state regardless of which user's backup service was actually being started.
Confirmed via git blame as genuine six-year-old upstream AOSP code (commit 9e111f19df8e5, 2019-11-15) that no AegisOS patch has ever touched (git log --grep=^aegisos -- services/backup/ returns nothing) — harmless on every ordinary Android flow, since user 0 is always already unlocked by the time any other user's backup service starts on a normal multi-user switch (you must unlock the primary user to even reach the switcher UI); Duress Unlock's decoy-routing mechanism is the first and only path in AOSP's own history, as far as this investigation found, that starts and unlocks a secondary user's session while user 0 has never unlocked at all.
Fixed with a one-line substitution (mContext → userContext) plus an explanatory comment. Authored under the established local-first worktree discipline (fetched file confirmed byte-identical via sha256sum before editing, landed via git am on the real branch after confirming no build was in flight) and rebuilt (m -j8, lynx-cur-userdebug, OFFICIAL_BUILD=true reconfirmed, 224 steps, 3m34s — fast, since only this one file changed).
Independent verification found system_ext.img had genuinely changed between the two build runs despite the patch never touching anything in that partition, consistent with this project's own documented build non-determinism history (ADR-021 through 029) — traced to a stale locally-cached comparison file, not a build defect, and resolved by re-downloading the fresh partition before re-verifying; the signed candidate itself (all 12 partitions plus vbmeta.img, same alpha key/rollback index/padding as ADR-072) is 13/13 independently verified on two machines.
The owner flashed it personally and re-ran the exact original trigger scenario for real: a fresh boot, decoy PIN entered directly with user 0 never credential-unlocked. The device's own event log shows the full unlock sequence completing cleanly through ssm_user_unlocked: 10 with no crash and no reboot; dumpsys dropbox shows no new crash entry, only the prior incident's own record.
3Consequences
Patch exported to aegisos-platform/credential/duress-unlock-decoy/patches/frameworks-base/0030, SOURCE.md updated; incident detail recorded in docs/devices/lynx-duress-decoy-backup-context-crash-incident.md. This is now hardware-confirmed fixed for the exact reproduced scenario — not merely compile-verified, unlike most of this audit's other fixes.
4Review when
If a future AOSP/GrapheneOS merge or upstream sync touches UserBackupManagerService.java, re-check this exact line survived the merge; a naive upstream rebase could silently reintroduce the wrong-context bug if the surrounding code is refactored.
Separately, the owner has raised a materially larger, distinct open question after this session: hiding other users' identity from the decoy session is not the same as making the decoy session look like the device's one true primary profile (e.g.
UserInfo.isMain()/admin status, setup-wizard-completion semantics, "End session" vs. primary-user UI affordances all currently still mark the decoy as an ordinary secondary profile even where its content is correctly filtered) — flagged as a real, separate design question for a future dedicated brainstorming/spec/plan cycle, not something resolved by this entry or the audit that preceded it.
ADR-065's Wallet-tile "treat decoy as main-user-equivalent" exemption is the one existing precedent to build from.
Read from docs/governance/decision-log.md, entry ADR-073.