Repository navigation
Description
Request: none
Problem
The only virtual Android devices simlock can create are SDK emulators. They are heavy: several GB of RAM each, slow cold boots, and they need the full Android SDK on the worker. Redroid (https://github.com/remote-android/redroid-doc) runs Android in a container. It boots in seconds and uses under 1 GB, which is enough for most agent work: installing an app, driving the UI, reading logs. simlock cannot use it today, and a worker can make only one kind of virtual Android device.
Who it is for
Operators who want more Android devices per worker, or Android on Linux hosts without the SDK emulator. Agents whose tasks do not need Play services, sensors or emulator console features.
Outcome
- A worker can run Redroid devices next to emulators and USB phones.
- An agent leases one with
--requires redroid, or gets one with a plain lease when the operator lists Redroid first. - The operator points simlock at a Docker engine: Docker Engine on Linux, or Colima (a Docker context) on macOS.
- Each lease gets a fresh
/data.
How it works for the user
flowchart TD
O[operator: android.virtualDevices = emulator, redroid] --> D[daemon start: one driver per backend]
D -->|docker engine unreachable or not Linux| R[redroid skipped, emulator runs; doctor says why]
A[agent: simlock lease --platform android --requires redroid] --> M{a backend carries every required name?}
M -->|no| C[CAPABILITY_MISSING]
M -->|yes| I{image for the Android version present?}
I -->|no, downloads off| RM[RUNTIME_MISSING: component install android redroid-14]
I -->|no, downloads on| P[docker pull, progress shown]
I -->|yes| B[docker create + start, adb connect, wait for boot]
P --> B
B -->|boot fails or times out| F[container removed, lease answers the failure]
B --> G[grant: serial 127.0.0.1:port]
G --> E[release: docker stop, docker rm, volume removed]
Before, on a Mac whose worker runs emulators only:
$ simlock lease --platform android --requires redroid
error CAPABILITY_MISSING: This worker cannot serve redroid
After, with "android": { "virtualDevices": ["emulator", "redroid"] } and Colima running with binder loaded:
$ simlock lease --platform android --requires redroid --model "Pixel 7" --os 14
{"leaseId":"...","device":{"platform":"android","backend":"redroid","model":"Pixel 7","osVersion":"14","address":"127.0.0.1:32775",...}}
$ simlock exec <lease> -- adb shell getprop ro.build.version.sdk
34
$ simlock lease --platform android --model "Pixel 7"
{"leaseId":"...","device":{"platform":"android","backend":"emulator",...,"address":"emulator-5556"}}
$ simlock baseline save <redroid lease> my-app
error BAD_REQUEST: A redroid device cannot be saved as a baseline; lease an emulator (--requires emulator) to save one
Doctor on a Mac whose Colima VM has no binder (T4):
$ simlock doctor
redroid-binder-missing: the Docker engine's kernel has no binder, so no Redroid device can boot
fix: colima ssh -- sudo apt-get install -y linux-modules-extra-$(uname -r) && colima ssh -- sudo modprobe binder_linux devices=binder,hwbinder,vndbinder
Examples
android.virtualDevices as written in config:
| Value | Today | After |
|---|---|---|
| absent | emulators | emulators (same as ["emulator"]) |
true |
emulators | emulators |
false |
phones only | phones only |
["emulator"] |
refused: not a boolean | emulators |
["emulator", "redroid"] |
refused | emulators and Redroid; a plain lease tries emulator first |
["redroid", "emulator"] |
refused | both; a plain lease tries Redroid first |
["redroid"] |
refused | Redroid only; phones still served |
[] |
refused | refused: android.virtualDevices must name at least one backend; use false for phones only |
["emulator", "emulator"] |
refused | refused: android.virtualDevices names emulator twice |
["docker"] |
refused | refused: android.virtualDevices names an unknown backend docker; known: emulator, redroid |
ios.virtualDevices: ["simulator"] |
refused | refused: iOS stays a boolean |
A plain or tagged lease on a worker with ["emulator", "redroid"], both images installed for Android 14, emulator images also for 15:
| Request | Today (emulator only) | After |
|---|---|---|
--platform android |
emulator | emulator (first in order) |
--requires redroid |
CAPABILITY_MISSING |
Redroid |
--requires emulator |
CAPABILITY_MISSING |
emulator |
--requires redroid --os 15 |
CAPABILITY_MISSING |
RUNTIME_MISSING naming redroid-15 (downloads off) or a pull (downloads on) |
--os 15 with order ["redroid", "emulator"], no redroid-15 image |
emulator | emulator: Redroid cannot make it without a download, the emulator can |
--os 16 with order ["redroid", "emulator"], neither has 16 |
RUNTIME_MISSING |
RUNTIME_MISSING of the first backend in order that knows 16; Redroid does not know 16, so the emulator's |
--requires redroid,emulator |
CAPABILITY_MISSING |
CAPABILITY_MISSING: no device carries both |
--requires redroid --model "TV (1080p)" |
CAPABILITY_MISSING |
UNKNOWN_MODEL: Redroid serves phone and tablet profiles only |
--requires redroid --baseline my-app (an emulator baseline) |
CAPABILITY_MISSING |
CAPABILITY_MISSING: the baseline's devices are emulators |
--physical |
phone | phone (phones stay with the emulator backend) |
What could go wrong
- On macOS the Colima VM loses binder after a VM restart, and every Redroid lease fails until the operator loads it again. Likely, unless the docs show the provision hook; doctor names it.
- A plain lease lands on Redroid because the operator listed it first, and the app needs Play services. The operator's order decides; agents can ask
--requires emulator. - Redroid containers run
--privileged, so the worker user is root-equivalent on the VM or Linux host. - Upstream Redroid is close to dormant (last real change 2025-06); an image that stops booting has no fix upstream.
Words used
- backend: one way to make a platform's virtual devices on a worker, e.g.
emulatororredroidon Android,simulatoron iOS. - Redroid: Android userspace in a Linux container on the host kernel. It needs the binder kernel feature.
- Docker engine: the Docker-compatible service that runs the containers, e.g. Docker Engine on Linux, Colima on macOS (reached through a Docker context).
- Docker context: a named engine endpoint the
dockerCLI talks to, e.g.colima. - binder: the Android inter-process kernel feature; on Ubuntu it is the
binder_linuxmodule fromlinux-modules-extra. - image table: the Redroid image tags simlock knows, one per Android version, e.g.
14→redroid/redroid:14.0.0_64only-240527. - Redroid component: one image of the table, named
redroid-<Android major>, e.g.redroid-14.
Non-goals
- simlock does not build, ship or mirror Redroid images. It pulls the upstream image at run time.
- simlock does not bundle or build kernel modules (redroid-modules is GPL-2.0). Docs point to the distro's packages.
- Docker Desktop and OrbStack: their kernels lack binder or other features Redroid needs.
- Windows/WSL2 in v1 (needs a custom kernel).
- Play services, camera or emulator console features on Redroid devices.
- simlock creating, starting or upgrading a Colima or other VM, or loading kernel modules.
- Baselines and warm-pool devices on Redroid in v1.
- Per-backend device limits; a Redroid device counts against the Android limits.
- Podman's own CLI; Podman only through its Docker-compatible socket (
host).
Completion conditions
- On a Mac with Colima (binder loaded),
simlock lease --platform android --requires redroidreturns a booted Redroid device, and adb, screen and input work through simlock. - On a Linux worker the same lease returns a booted Redroid device. The maintainer checks this once by hand (the slow-lane Redroid test on a Linux host) before Redroid devices as a second Android backend #2041 closes.
- The same worker still leases emulators and USB phones while Redroid devices are leased.
- A second Redroid lease after the first ends gets a device with no data from the first.
- After a daemon restart, a leased Redroid device is still reachable; a labelled container no device record names is listed by doctor and removed only by
doctor --purge-orphans. - Doctor reports a missing
dockerCLI, an unreachable or non-Linux engine, and a kernel without binder, each with a fix line.
Open questions
none
Decisions
- Decided by the maintainer: doctor checks binder with a one-off
alpine:3.20container (grep -w binder /proc/filesystems), because the Redroid image cannot run a one-off command (exec /system/bin/grep: no such file or directory). - Decided by the maintainer: the Linux completion condition is checked once by hand by the maintainer; the slow lane stays on Macs.
- Decided in the session: a Redroid boot that never completes fails with the existing boot timeout, and its message points to
simlock doctor. No row rests on what Redroid prints without binder: the module could not be unloaded on the probe VM (rmmod: ... Device or resource busy). - Decided in the session: an image enters the image table only after the slow-lane test boots it; T3's test drops any tag that fails. Only 14 was booted in the session.
- ADR 0102: An Android worker may run several device backends, and Redroid is one (draft PR docs(adr): 0102 several Android device backends, Redroid one (#2041) #2042).
- Decided by the maintainer: several backends per platform per worker (emulator + redroid + phones), not one per platform.
- Decided by the maintainer: drafts feat(backends): register local backend modules #1497, feat(backends): persist device backend ownership #1499, feat(backends): preserve saved baseline ownership #1500 and feat(android): add an AgentDeviceCloud backend #1498 are closed as superseded. This feature reuses their split: a light backend definition in the driver registry and a heavy backend module in the daemon, plus a
backendon device and baseline records. ADC can return later as another backend on the same abstraction. - Decided by the maintainer: hosts in v1 are Linux and macOS through Colima.
- Decided by the maintainer: the operator sets up the Docker engine and binder. simlock does not create or manage a VM. Doctor finds a missing engine or binder and prints the fix, and the website gives the recipe.
- Decided by the maintainer: operator order decides routing.
android.virtualDeviceslists backends in order, and a lease with no backend tag goes to the first backend that fits it. - Decided by the maintainer: no baselines on Redroid in v1.
baseline saveon a Redroid lease is refused with a clear message. - Decided by the maintainer:
android.virtualDevicesis widened totrue | false | string[], wheretrue=["emulator"]andfalse= phones only. Existing configs keep working. - Decided by the maintainer:
--modelon Redroid uses simlock's shipped Android profiles (e.g.Pixel 7) for screen width, height and dpi. The catalog lists the same models. - Decided by the maintainer: simlock knows the upstream Redroid image tags and pulls one on the first lease that needs it, like an emulator system image.
component install/removeworks for them. - Decided in the session: the backend id (
emulator,redroid) is a tag its devices carry, so--requires redroid(or--requires emulator) picks a backend with no new lease field, because tags already route leases on worker and gateway. - Decided in the session: Redroid is not part of the warm pool, because the warm pool is being deprecated.
- Decided in the session: Redroid runs
--privileged, and the worker user must be able to use Docker. Both are documented as root-equivalent, because Redroid cannot run any other way. - Decided in the session: a Redroid device's adb port is published on
127.0.0.1only, because an open adb port is a remote shell. - Decided in the session: all Android backends share simlock's own adb server, because agent-device and
device.execget one adb server port per worker. - Decided in the session: simlock drives the
dockerCLI with an optionalcontextorhost(Colima is a Docker context). Podman counts only through its Docker-compatible socket, because one CLI keeps v1 small. - Decided in the session: phones stay in the emulator backend in v1. A separate phones backend comes later, because v1 must not change how phones work.
- Decided in the session: each container and volume carries simlock labels (instance, device, backend). Ownership is the label, never the name, as with the owned root. A labelled container with no device row is an orphan, removed only by
doctor --purge-orphans. - Decided in the session: iOS gets one backend id,
simulator, andios.virtualDevicesstays a boolean, because iOS has one way to make devices. - Decided in the session: a plain lease goes to the first backend in order that can make the model and OS with what is installed; when none can, to the first backend in order whose catalog knows the version (it then downloads or answers
RUNTIME_MISSING), because a lease should not download for one backend what another already has. - Decided in the session: the Android adb server and SDK lookup move into a shared Android host that both backends use. The host needs only
platform-tools/adb; the emulator backend still needs the full SDK, so a worker with platform-tools alone can run Redroid only. - Decided in the session: a catalog entry's
virtualTagsadds the id of each running backend. The gateway routes--requires redroidon that union; a worker that has both backends but not the right image answers the refusal, because per-backend catalogs would be a second catalog shape for a rare case. - Decided in the session: device views in
status,leaseandlistcarrybackend; events are unchanged, because they name the device id and the view has the rest. - Decided in the session: the image table pins dated tags (e.g.
14.0.0_64only-240527), never-latest, so a worker never boots an image simlock did not test. v1 lists Android 12, 13, 14 and 15; 16 is left out because its arm64 image did not boot in the one Mac report. - Decided in the session: a Redroid device is shut down with
docker stop -t 2, because Redroid's init ignores SIGTERM (adocker stop -t 10took 11 s and exited 137). - Decided in the session: a Redroid device's RAM is counted with a new
ramBudget.redroidBytesPerDevice, default 1 GiB, because counting it as an emulator would cut the density that is the point of Redroid. - Decided in the session: Redroid serves only library profiles of class phone or tablet, because Redroid has no TV, Wear or automotive images.
- Decided in the session: GPU mode is Redroid's default (
guest, CPU rendering) in v1, because a Mac VM has no host GPU to give.
Licensing (research 2026-12-02): pulling the upstream image at run time distributes nothing, so simlock's MIT licence is unaffected; shipping images would carry GPL source duties and Google's proprietary libndk_translation (amd64 images). Redroid's own repos have no LICENSE file; the only grant is redroid-doc/README.md ("redroid itself is under Apache License"). The docs say the image is third-party with its own licences.
Behaviours
| Id | Behaviour (invoker, action, what it sees) | Seam | Cases | Task |
|---|---|---|---|---|
| B1 | A daemon starts on a state.db from before this feature: every device and baseline row gets its backend, and leases, devices and baselines go on as before. |
Registry.load over a migrated database, as in src/core/registry-state-db.test.ts |
android virtual row → emulator; android physical row → emulator; ios rows → simulator; baseline rows by platform; a database already at the new version is unchanged |
T1 |
| B2 | Core and leasing send every verb on a device to the backend its record names (S1), never to "the platform's driver". | DriverCatalog with two FakeDrivers (src/core/fake-driver.ts:147) of one platform, src/core/driver-catalog.test.ts |
provision, makeReady, shutdown, destroy, screen, input, device TCP and passthrough on a device of backend A reach A only; the same on B; a physical device reaches the backend that serves phones; a record naming a backend that is not running answers NO_DRIVER as a missing platform does today |
T1 |
| B3 | The startup read, the reconciler and doctor read each backend apart: one backend that cannot list leaves the others readable, and drift is reported per backend. | readStartup in src/core/startup-read.test.ts with two fake backends |
both list; one throws (its devices skipped, not deleted); one passes the limit; a device whose backend listed it gone is marked missing | T1 |
| B4 | Devices of two backends never share a pool: a ready device of one backend is never granted for a spec of another. | sameSpec in src/core/domain.test.ts; the planner in src/leasing/acquisition-planner.test.ts |
same model, OS and tag, different backend → not the same spec; same backend → same | T1 |
| B5 | An operator sets android.virtualDevices (I3) and the config loads or is refused with the message in I3. |
the config loader, src/core/config-platform-and-driver-settings.test.ts |
every row of the first Examples table | T2 |
| B6 | The daemon starts one driver per listed backend, in list order; a backend that fails to start is skipped with driver.backend-rejected (I6) and the others run. |
discoverDrivers with a drivers module, src/daemon/driver-discovery.test.ts |
true; false (emulator backend still starts, for phones); two backends; the second fails; the first fails (phones are then not served, as today when the Android driver is refused) |
T2 |
| B7 | An agent's virtual lease is routed to a backend by its requires and the operator's order (I4). |
buildDispatcher (src/daemon/test-dispatcher.ts:184) with two fake Android backends |
every row of the second Examples table but the baseline and physical rows | T2 |
| B8 | A lease naming a baseline goes to the backend that saved it, and is refused when requires names another backend. |
buildDispatcher with two fake backends and a saved baseline |
baseline of backend A, no requires → A; requires A → A; requires B → CAPABILITY_MISSING (I4) |
T2 |
| B9 | catalog.get lists the running backends' ids in the platform's virtualTags; status, lease and list device views carry backend (I5). The gateway routes --requires redroid only to workers whose catalog has it. |
src/daemon/dispatcher.test.ts:297; the gateway's src/gateway/routing/pipeline.test.ts |
one backend; two; false (no ids, as today); gateway: worker with redroid tag picked, worker without passed over as today for a tag |
T2 |
| B11 | The warm pool never learns a kind from a Redroid grant, and its targets and learned kinds resolve only on the emulator backend. | src/leasing/create-leasing-warm-pool.test.ts with two fake backends |
a Redroid grant learns nothing; an emulator grant learns as today; a target with order ["redroid", "emulator"] makes emulators |
T2 |
| B12 | The operator lists redroid; the daemon starts the Redroid backend when the engine answers as Linux, else skips it with driver.backend-rejected naming why. |
discoverDrivers with ScriptedProcessRunner (src/ports/scripted-process-runner.ts:51) answering I7 |
engine Linux arm64 → starts; docker not found; context not found; socket refused; engine not Linux |
T3 |
| B13 | An agent leases Redroid: simlock creates a labelled volume and container, starts it, reads its port, connects adb on simlock's server and waits for boot (I7, I8), then grants serial 127.0.0.1:<port>. |
the Redroid driver over ScriptedProcessRunner with replies captured in I7 and I8 |
success; adb connect prints failed to connect (exit 0) then succeeds; device offline while booting; sys.boot_completed never 1 within android.bootTimeoutMs → boot failure, container destroyed; container exits during boot (docker inspect state exited) → failure naming the exit code; name clash on create (Conflict) → provision failure |
T3 |
| B14 | A Redroid lease ends: simlock disconnects adb, stops the container, removes it and its volume; the next lease's device has none of the first's data. | the Redroid driver over ScriptedProcessRunner; the slow-lane test e2e/slow-android-redroid.test.ts |
stop then remove; remove of a container already gone (docker rm -f exits 0, prints nothing); volume already gone (no such volume) → done; docker stop of a missing container → treated gone; second lease: /data/local/tmp/m written by the first is absent |
T3 |
| B15 | A Redroid device booted again (recovery, or after a daemon restart) is reached on its new port, never the stored one. | the Redroid driver, makeReady with purpose: "recover" |
port 32775 before stop, 32776 after start (captured in I7); old serial disconnected, new one connected | T3 |
| B16 | After a daemon restart, the Redroid backend lists the containers labelled with this instance and reconnects the running ones; doctor lists a labelled container no record names, and doctor --purge-orphans removes it and its volume. |
listManaged over ScriptedProcessRunner; doctor in src/core/doctor-observed-state.test.ts with a fake backend |
running container with a record → reconnected; stopped container with a record → stopped; record whose container is gone → missing; container of another instance's label → not listed; orphan → finding, purged only with --purge-orphans |
T3 |
| B17 | A Redroid lease's commands, screen, input and tunnels work through simlock's adb server: the lease environment names the serial and the server port; adb passthrough is scoped to the serial and refuses emu. |
the Redroid driver's leaseEnvironment and passthrough rules; the slow-lane test |
adb shell runs; adb emu ... refused like another device's serial; adb -s <other serial> refused; screencap and input tap work (slow lane) |
T3 |
| B18 | catalog.get on a worker with Redroid lists the phone and tablet library profiles and the Android versions whose images are installed (I9). |
the Redroid driver's listCatalog over ScriptedProcessRunner |
images 14 installed → runtime 14; none installed → no runtimes; TV, Wear, automotive and desktop profiles absent |
T3 |
| B19 | baseline save on a Redroid lease is refused before the lease ends (I10); the lease goes on. |
src/core/baselines.ts save path with a fake backend that has no saveSource |
Redroid lease → BAD_REQUEST, lease still held; emulator lease → saved as today |
T3 |
| B20 | A Redroid device counts against the Android device limits with ramBudget.redroidBytesPerDevice of RAM (I11). |
the resource strategy in src/leasing/create-leasing-ram-budget.test.ts |
Redroid device counts its own figure; emulator unchanged; key absent → 1 GiB | T3 |
| B21 | A Redroid lease whose image is missing pulls it when downloads are allowed (progress per layer), and records the component; otherwise answers RUNTIME_MISSING naming redroid-<major>. |
the component installer, src/core/component-installer-remove.test.ts beside its install tests, with a fake backend and ScriptedProcessRunner replies from I12 |
downloads on → pull, component.installed; downloads off → RUNTIME_MISSING; tag not found upstream → install failure with the daemon's message; second request during the pull joins it |
T4 |
| B22 | An operator runs `simlock component install | list | remove android redroid-14`; remove is refused while a device uses it. | the component installer and simlock component CLI tests |
| B23 | simlock doctor on a worker that lists redroid reports what keeps Redroid from booting, with a fix line (I13). |
doctor with Redroid prerequisites over ScriptedProcessRunner |
all fine → nothing; docker not found; context not found; engine down; engine not Linux; binder missing; worker that does not list redroid → no Redroid checks |
T4 |
Stored state
| Id | What and where | Created, changed, deleted by | Listed or swept by | A restart mid-step leaves | Schema step | Task | Used by |
|---|---|---|---|---|---|---|---|
| S1 | devices.backend in state.db (src/core/registry-schema.ts): the backend id that made or serves the device |
written by DeviceProvisioner with the row; for a physical device by enrolment, as the backend that serves phones; filled for old rows by the migration (B1); never changed |
read by Registry.load and every driver lookup (I1) |
nothing new: the row and its backend are one insert | registry +1 | T1 | T2, T3 |
| S2 | baselines.backend in state.db (src/core/baselines-schema.ts): the backend that saved the baseline |
written by a save from the device's S1; filled by the migration; deleted with the row | read by a lease naming the baseline (B8) | nothing new | baselines +1 | T1 | T2 |
| S3 | redroid_device_data in state.db: device_id, container (name), volume, image (tag), image_id (sha256:...) |
written with the device row by the Redroid backend's provision; deleted with the row | read by Registry.load for Redroid devices |
the row is written before docker create (as today the device row comes first); a crash between leaves a row whose container is gone → marked missing at start (B16) |
redroid-device-data +1 | T3 | — |
| S4 | Docker containers and volumes on the engine, labelled simlock.instance=<instance id>, simlock.device=<device id>, simlock.backend=redroid |
created by provision (B13); stopped by shutdown; removed by destroy (B14) or doctor --purge-orphans (B16) |
listManaged (docker ps -a --filter label=simlock.instance=<id>), doctor |
a container with no row is an orphan: listed by doctor, removed only by --purge-orphans |
none | T3 | T4 |
| S5 | Redroid images on the engine, recorded as components android / redroid-<major> in the existing components records |
docker pull by the component installer (B21, B22); docker image rm by component remove |
component list, catalog.get |
a pull cut short leaves layers the engine keeps or discards itself; no record is written until the pull ends | none | T4 | — |
Interfaces
| Id | What | Shape and bounds | Errors and limits | Where | Task | Used by |
|---|---|---|---|---|---|---|
| I1 | Driver.backend and the catalog lookup by backend |
Driver gains readonly backend: string ([a-z][a-z0-9-]{0,31}); DriverSpec's VirtualSpec and PhysicalSpec gain backend: string, part of sameSpec; DriverCatalog.get(spec) answers the driver of spec.platform and spec.backend; select(platform) answers all of a platform's backends in configured order; device-data tables keyed by platform/backend |
a spec whose backend is not running: NoDriverError (NO_DRIVER), message No driver registered for android/redroid |
src/core/driver.ts, src/core/domain.ts, src/core/driver-catalog.ts |
T1 | T2, T3, T4 |
| I2 | Backend definitions and modules | light: BackendDefinition { platform; id; settings: DriverConfigEntry } listed in src/driver-registry/index.ts; heavy: a module the daemon lists, create(context) → Promise<Driver>, deviceDataTable, prerequisites(context); a new backend is its folder plus one line in each list |
— | src/driver-registry/, src/daemon/driver-discovery.ts |
T2 | T3 |
| I3 | Config key android.virtualDevices |
boolean or an array of 1 to 8 backend ids, no repeats; true = ["emulator"]; ios.virtualDevices stays boolean |
messages word for word: android.virtualDevices must name at least one backend; use false for phones only; android.virtualDevices names <id> twice; android.virtualDevices names an unknown backend <id>; known: <ids> |
src/core/config-validators.ts, src/core/config-types.ts |
T2 | T3 |
| I4 | Backend routing of a virtual lease | names in requires that are backend ids narrow the backends; then each backend in order is asked resolveSpec with downloads off; the first that resolves takes it; if none, the first whose catalog knows the version gets the request as today (download or RUNTIME_MISSING) |
CAPABILITY_MISSING with the existing message This worker cannot serve <names> when no running backend carries a required name; when the names exist but no one backend carries all, No one android backend here carries <names>; a baseline of another backend: Baseline <name> was saved on <backend>; it cannot serve <names> |
src/leasing/acquisition-spec-resolver.ts, src/daemon/dispatcher-leases.ts |
T2 | T3 |
| I5 | Contract: device view backend; catalog virtualTags with backend ids |
device view gains backend: string (same pattern as I1), required on output; virtualTags unchanged in shape. Bumps the protocol by one. |
an older client strips nothing it does not read | src/contract/device-schemas.ts, src/daemon/dispatcher-status.ts |
T2 | — |
| I6 | Event driver.backend-rejected |
{ platform, backend, reason: "engine-unreachable" | "engine-not-linux" | "docker-missing" | "sdk-missing" | "adb-server-unavailable", message }; EVENTS.md entry added; the existing driver.adb-server-rejected stays for the shared host |
emitted once per start per skipped backend | src/bus/index.ts, docs/internal/EVENTS.md |
T2 | T3 |
| I7 | Docker CLI calls of the Redroid backend, each through ProcessRunner with --context <c> or DOCKER_HOST=<h> when set |
docker info --format '{{.OSType}} {{.Architecture}}' → linux aarch64; docker volume create --label ... simlock-<instance8>-<device>-data → the name; docker create --name simlock-<instance8>-<device> --privileged --label ... -p 127.0.0.1::5555 -v <volume>:/data <image> androidboot.redroid_width=<w> androidboot.redroid_height=<h> androidboot.redroid_dpi=<dpi> → container id; docker start <name> → the name; docker port <name> 5555 → 127.0.0.1:32775; docker inspect --format '{{.State.Status}} {{.State.ExitCode}} {{.Image}}' <name>; docker stop -t 2 <name>; docker rm -f <name>; docker volume rm <volume>; docker ps -a --filter label=simlock.instance=<id> --format '{{.Names}} {{.State}} {{.Label "simlock.device"}}' |
replies captured 2026-12-02 on Colima, Docker 29.5.2, in /private/tmp/claude-501/redroid-design/facts1.log to facts7.log: port before start → no public port '5555' published for <name> (exit 1); name clash → Conflict. The container name "/<name>" is already in use (exit 1); rm -f of a missing container → exit 0, no output; volume rm missing → no such volume (exit 1); stop missing → No such container (exit 1); context missing → context "<c>" not found (exit 1); socket missing → failed to connect to the docker API at <h> (exit 1). Limits: info 10 s, create/start/port/inspect/ps 30 s, stop 15 s, rm 30 s. Engine stopped: not captured (Open questions) |
src/drivers/android/redroid/ |
T3 | T4 |
| I8 | adb on simlock's server for a Redroid device | adb -P <port> connect 127.0.0.1:<p> → connected to 127.0.0.1:<p> or already connected to ... (exit 0); refused → failed to connect to '127.0.0.1:<p>': Connection refused with exit 0, so the text decides; adb -s <serial> shell getprop sys.boot_completed → 1; while starting → adb: device offline (exit 1); pm path android → package:/system/framework/framework-res.apk; disconnect → disconnected <serial>, again → error: no such device '<serial>' (exit 1, treated done); emu avd path exits 1 with no output (not a readiness signal) |
boot wait bounded by android.bootTimeoutMs; each adb call 10 s |
src/drivers/android/redroid/ |
T3 | — |
| I9 | Redroid settings drivers.android.redroid.* and image table |
context (Docker context name, 1 to 64 of [A-Za-z0-9._-]), host (a unix://, tcp:// or npipe:// URL, 1 to 512 chars), not both; cpus (number > 0, optional); memoryMiB (integer ≥ 512, optional). Image table in code: 12 → 12.0.0_64only-240527, 13 → 13.0.0_64only-240527, 14 → 14.0.0_64only-240527, 15 → 15.0.0_64only-250627, repository redroid/redroid |
drivers.android.redroid.context and host cannot both be set; out-of-range values use the loader's existing messages |
src/drivers/android/redroid/definition.ts |
T3 | T4 |
| I10 | Baseline save refused on a backend without saveSource |
Driver.saveSource becomes optional; baseline.save checks the lease's device's backend before releaseToSave |
BAD_REQUEST: A redroid device cannot be saved as a baseline; lease an emulator (--requires emulator) to save one (the backend id fills redroid) |
src/core/driver.ts, src/core/baselines.ts |
T3 | — |
| I11 | Config key ramBudget.redroidBytesPerDevice |
positive integer bytes, default 1 GiB; also under capacity.config.resource.ramBudget |
the loader's existing number messages | src/core/capacity/strategies/resource/index.ts, src/core/config-validators.ts |
T3 | — |
| I12 | Redroid components | id redroid-<major> for a major in the image table; install = docker pull redroid/redroid:<tag>, progress per line <layer>: Pull complete out of the layers seen; remove = docker image rm <tag>; size from docker image inspect --format '{{.Size}}' (674553971 for 14) |
unknown id: Unknown component redroid-99; known: redroid-12, redroid-13, redroid-14, redroid-15; tag missing upstream: the daemon's failed to resolve reference ... not found passed on; pull bounded by downloads.timeoutMs |
src/drivers/android/redroid/, src/core/component-installer.ts |
T4 | — |
| I13 | Doctor findings of the Redroid backend | redroid-docker-missing, redroid-engine-unreachable, redroid-engine-not-linux, redroid-binder-missing, each { prerequisite, message, remedy }; binder check: docker run --rm alpine:3.20 grep -w binder /proc/filesystems (prints nodev\tbinder, exit 0, when loaded; exit 1 when not), which pulls alpine:3.20 (about 4 MB) once; the finding says so |
remedies: install Docker / start Colima / pick a Linux engine / the two colima ssh lines in How it works (Linux: sudo apt-get install linux-modules-extra-$(uname -r) and sudo modprobe binder_linux devices=binder,hwbinder,vndbinder) |
src/drivers/android/redroid/prerequisites.ts |
T4 | — |
Existing code
Commit 447cc5b.
Searches: drivers.get( / catalog.get( / #drivers.get( over src without tests (57 hits, 41 lookups by platform); virtualDevices (24 hits); virtualTags (19); deviceDataTables (20); CREATE TABLE devices / CREATE TABLE baselines (2); virtualLeaseEnvironment (3); releaseToSave (4); class .* implements Driver (3); discoverSdk / locateSdk (2).
| Id | Code (path:line) | Today | With this feature | Handled by |
|---|---|---|---|---|
| X1 | src/core/driver-catalog.ts:84 |
the catalog maps a platform to one driver; get(platform) at :94 |
keyed by platform and backend; lookups take the device's spec | B2, I1 (T1) |
| X2 | src/core/reclaim-coordinator.ts:111 |
reclaim, shutdown and destroy look the driver up by device.spec.platform (also :165, :269, :318, :355, :403) |
by the device's spec, so the backend comes with it | B2 (T1) |
| X3 | src/core/managed-device-lifecycle.ts:115 |
every lifecycle verb by platform (also :182, :209, :282, :294) |
by spec | B2 (T1) |
| X4 | src/leasing/acquisition-workflow.ts:242 |
timing, provisioning and boot by platform (also :248, :256, :352, :397) |
by spec | B2 (T1) |
| X5 | src/core/startup-read.ts:40 |
one listing per driver, kept by platform at :47 |
one per backend, kept by platform and backend | B3 (T1) |
| X6 | src/core/registry-schema.ts:4 |
devices has platform and no backend; the owner is at version 11 (:182) |
backend column, filled by platform |
B1, S1 (T1) |
| X7 | src/core/baselines-schema.ts:4 |
baselines has no backend |
backend column |
B1, S2 (T1) |
| X8 | src/core/registry-rows.ts:628 |
a device's data table is found by platform (also write at :320) |
by platform and backend | B1, I1 (T1) |
| X9 | src/daemon/driver-discovery.ts:103 |
the production device-data tables are one per platform | one per backend; Redroid's added in T3 | I1 (T1), S3 (T3) |
| X10 | src/core/domain.ts:105 |
sameSpec compares platform, model, OS, mode, tag, baseline |
and backend | B4 (T1) |
| X11 | src/core/config-validators.ts:271 |
android.virtualDevices is booleanValue |
boolean or a list of backend ids | B5, I3 (T2) |
| X12 | src/core/config-types.ts:189 |
virtualDevices: boolean |
boolean | readonly string[] for Android |
I3 (T2) |
| X13 | src/daemon/driver-discovery.ts:132 |
discovery starts iOS, then one Android driver | the Android host, then each listed backend in order | B6 (T2), B12 (T3) |
| X14 | src/daemon/dispatcher-leases.ts:66 |
a virtual lease's requires is checked against the platform's virtualTags only |
against those plus the running backends' ids | B7 (T2) |
| X15 | src/leasing/acquisition-spec-resolver.ts:78 |
resolveSpec refuses when the platform's virtual devices are off, then resolves on the one driver (:390) |
off means false; resolution walks the backends (I4) |
B7, B8 (T2) |
| X16 | src/daemon/dispatcher-status.ts:64 |
a catalog entry's virtualTags is the platform's config list |
plus the running backends' ids | B9 (T2) |
| X17 | src/gateway/routing/stages/has-capabilities.ts:22 |
a worker serves a name when its catalog's virtualTags has it |
unchanged code; the union now holds backend ids | B9 (T2) |
| X18 | src/contract/device-schemas.ts:142 |
the device spec on the wire has no backend | backend added (protocol bump) |
I5 (T2) |
| X19 | src/core/warm-pool/learned.ts:7 |
learned kinds key on platform, model, OS, mode, tag | unchanged; kinds are learned and planned on the emulator backend only | B11 (T2) |
| X20 | src/core/doctor.ts:547 |
warm-target reachability reads virtualDevices as a boolean |
reads "has any backend" | B5 (T2) |
| X21 | src/daemon/worker-composition.ts:301 |
the lease environment merges every driver's virtualLeaseEnvironment(), one adb server port per worker |
both Android backends give the shared host's port, so the merge is unchanged | B17 (T3) |
| X22 | src/drivers/android/index.ts:469 |
AndroidDriver.create finds the full SDK and starts simlock's adb server (:498) |
the shared Android host does both; the emulator backend takes it | B12 (T3) |
| X23 | src/drivers/android/sdk-paths.ts:97 |
an SDK is complete only with the emulator, adb and cmdline-tools | the host needs adb alone; the emulator backend checks the rest | B12 (T3) |
| X24 | src/drivers/android/profiles/index.ts:21 |
the library profiles; pixel-7.ts:76 holds hw.lcd.density 420, height 2400 |
Redroid reads width, height and density from the same entries, phone and tablet only | B18 (T3) |
| X25 | src/core/baselines.ts:139 |
#save ends the lease first (releaseToSave), then asks the driver |
a backend with no saveSource is refused before the lease ends |
B19, I10 (T3) |
| X26 | src/core/capacity/strategies/resource/index.ts:26 |
RAM per device is iosBytesPerDevice or androidBytesPerDevice |
Redroid devices use redroidBytesPerDevice |
B20, I11 (T3) |
| X27 | src/core/component-installer.ts:197 |
install and remove find the driver by platform (also :285) |
a redroid- id goes to the Redroid backend, any other to the platform's first backend |
B21, B22 (T4) |
| X28 | src/drivers/android/AGENTS.md:43 |
readiness needs emu avd path naming the device's folder |
the Redroid backend's readiness is sys.boot_completed and pm path android only; emu exits 1 there (I8) |
B13 (T3) |
Tasks
Written after the design check.
Written by an agent.
Activity
docs(adr): 0102 events keep their shape (#2041)
V3RON commentedon Dec 2, 2026
Design posted: How it works, Examples, Behaviours B1–B23, Stored state, Interfaces, Existing code, four tasks T1–T4; Open questions settled (alpine binder check, Linux checked by hand).
Written by an agent.