M7: on-device validation - fix usage-screen latency and first-run copy

This commit is contained in:
2026-10-14 17:05:03 +02:00
parent e2cfb5d9ca
commit a79b7eb58e
8 changed files with 158 additions and 27 deletions
+62
View File
@@ -0,0 +1,62 @@
# On-device testing
What has actually been run on hardware, what it found, and what is still unverified. Keep
this file honest: an untested claim is a bug waiting to be reported.
## Devices used
| Device | Android | Notes |
|---|---|---|
| Xiaomi **M2101K7AG** (Redmi, `sunny`), MIUI V140 | 12 (API 31), arm64-v8a | A real phone with a real 55 GB library. Auto-rotate was on, so runs happened in both orientations. |
| AOSP `phone` AVD | 12 (API 31), x86_64 | Software emulation — the host exposes no `/dev/kvm`. Used from M0–M6. |
Connecting a phone to this dev container needs one fix: the USB node is created
`root:plugdev 0660`, and the container's user is not in `plugdev`, so adb cannot open it.
An udev rule widening the mode for Android vendors fixes it
(`/etc/udev/rules.d/51-android.rules`), after which `adb devices` sees the phone.
## Verified on the real device
| What | Result |
|---|---|
| First run, no permission granted | The "Choose a folder" prompt appears with both routes offered: *Grant full access* and *Choose folder*. Correct — the app has no source yet, so the SAF fallback is the honest state. |
| Granting "All files access" while the app is alive | The app picks it up on resume and switches from the prompt to the roots view, showing **"Internal storage · 50.0 GB free"** (matching `df`). The lifecycle refresh works. |
| Browsing real storage | Real folders listed alphabetically with correct icons and breadcrumbs ("Internal storage / Download"). Titles render "Internal storage", not the raw volume name. |
| Text editor, read | Tapping `a.txt` opened the editor showing its real content. |
| Text editor, **write** | Editing and tapping Save persisted to the device — verified independently with `adb shell cat`. |
| Storage usage | DCIM 2.7 GB / 668 files, Android 1.2 GB / 5925 files, Music 1.2 GB / 43 files, Pictures 866.4 MB / 5849 files, … sorted largest first with per-row share bars and correct plurals. |
| Revoking "All files access" mid-use | Returned to the folder prompt without crashing; the app kept running. Graceful degradation confirmed. |
| Landscape | The whole UI adapts (the phone auto-rotated mid-session): app bar, list, breadcrumbs and dialogs all laid out correctly. |
| `BACK` from the roots view | Exits the app, which is the expected Android behaviour. |
## Bugs this session found — both fixed
1. **The first-run copy was wrong.** The prompt read *"Full access was declined, so pick a
folder…"* on a device where the user had never declined anything. Reworded to
*"Without full access you can still work inside one folder you choose here."*, which is
true whether the user declined or simply has not granted yet. Re-verified on device.
2. **The storage-usage screen took ~45–60 seconds to show anything.** Measuring the root of
a real 55 GB volume blocked on the whole walk with only a spinner for company, which
reads as a hang. Two changes:
- `UsageAnalysis` now passes the `FileEntry` down the recursion instead of re-`stat`ing
every node (the parent's listing already says whether each child is a folder), so the
walk costs one listing per directory and nothing more.
- Rows are **published as they are measured** through an `onProgress` callback, and the
ViewModel appends them, re-sorting as it goes, so the biggest folders appear while the
rest of the tree is still being walked.
The UI never froze — the progress bar kept animating throughout, which confirms the I/O
stays off the main thread — but "slow and silent" is still a defect.
## Not verified, and why
- **Long-press multi-select via adb.** `input swipe x y x y 900` is delivered as a plain
tap on this MIUI build, so the selection action bar (and therefore compress/extract from
the UI) could not be driven from the host. The archive engine itself is covered by
end-to-end JVM tests, including a zip-slip archive. **Worth a manual pass.**
- **The SAF folder-picker round trip.** Driving the system picker and granting a tree was
not attempted; the code path is unit-tested against a stand-in `DocumentsProvider`.
- **Image viewer and thumbnails.** Verified on the AVD in M4/M5; not repeated on the phone.
- **The foreground-service notification** during a long copy. Started in M3 and unit-tested;
not observed on hardware.
- **Archive creation/extraction against real files.** Only exercised in-memory.