fix(phase-1/m2.4b): encrypted imports were a silent no-op on-device

Manual Waydroid pass (phone exports encrypted -> re-imports the same
file through the real UI) caught it: the confirm dialog closed but no
import ran and no snackbar appeared. PassphraseDialog.onConfirm's
shared preamble nulls all URI slots before routing on mode, and the
IMPORT branch never re-armed pendingImportUri -- so the preview
confirm dialog's Import button read null and skipped viewModel.import
entirely. Plain-JSON imports bypass the passphrase dialog, which is
why every scripted desktop leg (M2.1-2.5) stayed green.

Fix: re-arm pendingImportUri in the IMPORT branch before preview;
wrong-pw/dismiss paths still null it and zero the retained chars.

Verified on-device after rebuild + `waydroid app install`: export
snackbar, magic-sniffed "Decrypt backup" sheet, 4-note preview, and
the dedupe snackbar "Imported 0 note(s), skipped 4 already imported."

Also lands the Waydroid test rig used for the pass (tools/WAYDROID_
TESTING.md + tools/inject2.c: uinput tap/move/key/text/swipe injector)
and the full M2.4b write-up in DESKTOP_FEASIBILITY.md. M2 exit
criteria met: bidirectional lossless round-trip plain+encrypted.
This commit is contained in:
Incido Developer committed 2026-10-06 05:40:44 +13:00
1 parent 29288b0370
commit 561d16eb0c
4 files changed
+412

No files matched your search

+38
View File
@@ -461,6 +461,44 @@ Verdict: record, don't redesign (plan wording honoured). The streaming
formatVersion=2 idea stays parked for Phase 2 and becomes *required*
iff attachment libraries approach ~25 MB.
**M2 task 4b — on-device encrypted round-trip (Waydroid): DONE, one real
bug caught and fixed.** Manual UI pass on the Waydroid phone emulator
(rig + capture recipe in `tools/WAYDROID_TESTING.md`, injector in
`tools/inject2.c`). Phone exports encrypted, then re-imports the same
file through the real UI:
```
export: Settings → Export to file… → Encrypted → passphrase → Encrypt &
export → SAF SAVE → snackbar "Encrypted backup exported. Store
the passphrase safely." (file lands 2.77 kB, magic ICDBKP1)
import: Import from file… → picker shows the .incido.json → app sniffs
the magic → "Decrypt backup" single-field sheet → correct pw →
preview "4 note(s) / 0 attachment(s) / Exported from v0.4.2.0 /
Oct 5, 2026" → Import →
snackbar "Imported 0 note(s), skipped 4 already imported."
```
**The bug:** the encrypted import silently did nothing — the confirm
dialog closed but no import ran and no snackbar ever appeared.
`PassphraseDialog.onConfirm` runs a shared preamble that clears all four
URI slots (`pendingImportUri = null`, SettingsScreen.kt:383) *before*
routing on mode; the IMPORT branch previews from a local copy but never
re-arms the slot, so the confirm dialog's Import button read
`pendingImportUri == null` and skipped the whole `viewModel.import`
call. Plain-JSON imports never pass through the passphrase dialog, so
M2.1–M2.5 could not catch this — exactly why the device leg existed.
Fix: the IMPORT branch re-arms `pendingImportUri = importUri` before
launching the preview; wrong-passphrase and dismiss paths still null it
(and zero the retained chars). Verified fixed on-device with the
dedupe snackbar above.
Device-run notes (cost hours; recorded for M3's manual passes): taps
map 1:1 to screenshot pixels; TextButtons ignore Enter until Tab moves
focus onto them (keyboard nav is the reliable path); snackbars expire
before a 3 s-delayed screenshot — burst-capture spectacle at 1 s
intervals; `waydroid shell` needs sudo, but `waydroid app install` and
`pkill -f org.incido.app` from the host need none.