Files
Incido/tools/WAYDROID_TESTING.md
T
Incido Developer 561d16eb0c 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.
2026-10-06 05:40:44 +13:00

6.6 KiB
Raw Blame History

Waydroid: APK Install & Functional Testing Guide

Reference notes from the draft/trash feature testing session (23 Sep 2026), on this machine: KDE Plasma (Wayland), Waydroid full session, Incido app (package org.incido.app).


1. Prerequisites / environment check

waydroid status
# Want: Session: RUNNING, Container: RUNNING

If the session is not running (session-only command, no root needed):

waydroid session start          # starts the UI session (runs as your user)

Starting the container (waydroid container start) requires root; it is normally managed by a systemd unit and already running.

The app's data lives on the host at ~/.local/share/waydroid/data/data/org.incido.app/ but is owned by root — reading the SQLite DB from the host needs sudo (or sudo waydroid shell). If sudo demands a password (as on this machine) you cannot use root paths in automated runs — plan to verify through the UI instead.

2. Build & install the APK

cd ~/Desktop/Apps/Incido
./gradlew :app:assembleDebug -q          # exit 0 = success
# APK lands at: app/build/outputs/apk/debug/app-debug.apk

waydroid app install app/build/outputs/apk/debug/app-debug.apk

Notes learned the hard way:

  • waydroid app install needs no root — always prefer it over any adb install / cp into the container.
  • There is no attached adb device by default (adb devices → empty), so plain adb workflows do not work unless you enable waydroid root/adb integration first.
  • If the app was already running while reinstalling, relaunch it — the running process may keep the old code:
waydroid app launch org.incido.app     # also no root needed
waydroid app list | grep -i incido     # confirm installed package

3. Screenshots

scrot, import (ImageMagick is installed but has no usable X display), and gnome-screenshot are not available. Use Spectacle in CLI mode:

spectacle -b -n -o /tmp/shot.png   # -b no border, -n output file

Read the PNG back with the file-read tool to visually assert UI state.

4. Input injection (clicks / typing)

xdotool does not work for injecting into Waydroid under Wayland (XDG_SESSION_TYPE=wayland). KWin exposes an XWayland socket, but window search/injection via xdotool returns nothing useful.

The working solution is a userspace uinput injector: tools/inject2.c kept in this repo. Build once:

mkdir -p /tmp/incido_test && cd /tmp/incido_test
gcc ~/Desktop/Apps/Incido/tools/inject2.c -o inject2
# needs write access to /dev/uinput (group "input" or udev rule)

Usage — click etc. are SUBCOMMANDS (bare coordinates fail with "bad args"):

./inject2 move X Y        # warp virtual pointer
./inject2 click X Y       # warp + left click
./inject2 press           # click at current position
./inject2 drag X1 Y1 X2 Y2
./inject2 wheel N         # scroll
./inject2 type "text"     # virtual keyboard device
./inject2 key NAME        # esc, enter, backspace, up, down, left, right, ...
INJECT_HOLD=500000 ./inject2 click X Y   # keep uinput devices alive 0.5s

Coordinate mapping (important!)

Screenshots come back at 2560×1440, but the injector emits absolute events calibrated for a 1920×1080 screen. Therefore:

inject_x = screenshot_x × 0.75
inject_y = screenshot_y × 0.75

Measure the target on the screenshot, multiply by 0.75, then click that.

Known-good targets (already in inject2 space): hamburger (30, 35), drawer Home (85, 104), drawer Drafts (85, 206), drawer Trash (101, 403), card overflow menu ≈ (1868, 111), menu "Delete permanently" row ≈ (1792, 230).

Workflow that worked well

  • One click + sleep 1 + spectacle per step; read the PNG to assert.
  • After deleting the top list item the list reflows into the same position, so the same coordinates can be reused for repeated deletes.

5. Known failure mode: injection silently stops

Mid-session (after ~30 min of successful clicks), injected pointer AND keyboard events stopped reaching the Waydroid window entirely — screenshots showed no reaction to any input, while spectacle still worked and the app process was alive (ps -ef | grep incido).

Things that were tried and did not fix it (don't loop on these):

  • Re-activating the window via KWin Scripting DBus (qdbus6 org.kde.KWin /Scripting ...loadScript/start with a JS that sets workspace.activeWindow) — the script runs and logs activation, but input routing is unaffected.
  • waydroid app launch relaunch of the app.
  • Escape/Back key injection.
  • Repeated clicks at freshly computed coordinates.

Likely cause: KWin-side routing of the transient uinput device (created/destroyed per invocation) gets detached — e.g. after the session loses/gains focus, or the Python Waydroid UI stops hot-plugging newly created libinput devices.

Recovery options, cheapest first:

  1. Ask the user to physically click once inside the Waydroid window — this re-establishes input focus/routing. Then retry a single click.
  2. Restart the Waydroid session UI: waydroid session stop then waydroid session start (host UI only; the container survives). App state resets, so capture anything you still need before doing this.
  3. Keep ONE long-lived injector process alive (large INJECT_HOLD) instead of create→click→destroy per command, so the device never disappears between interactions. Prefer this if the failure recurs often.

Budget rule for agents: if 3 consecutive injected inputs produce no visible change in a screenshot, stop injecting — verify state another way (earlier screenshots, or one manual user click) instead of looping.

6. Verifying app state without UI (when root IS available)

sudo waydroid shell
ls /data/data/org.incido.app/databases/
sqlite3 /data/data/org.incido.app/databases/<db>.db \
  "SELECT COUNT(*), SUM(is_draft), SUM(deleted) FROM notes;"

(waydroid shell refuses without root: ERROR: Action "shell" needs root access. On this machine sudo is password-gated, so this path only works interactively with the user.)

7. Quick recipe (end-to-end)

cd ~/Desktop/Apps/Incido
./gradlew :app:assembleDebug -q && \
waydroid app install app/build/outputs/apk/debug/app-debug.apk && \
waydroid app launch org.incido.app

mkdir -p /tmp/incido_test && cd /tmp/incido_test
gcc ~/Desktop/Apps/Incido/tools/inject2.c -o inject2

./inject2 click 30 35        # open drawer
sleep 1; spectacle -b -n -o step1.png

…then screenshot after every action, and remember the ×0.75 scale when converting screenshot targets into inject2 targets.