Skip to content

Updating the Android emulator while T3 is running leaves the camera on "emulated", so camera images are ignored #39735

Closed

Description

@Tiaxi

What happened

An agent booted an Android emulator (Pixel 9 Pro AVD, API 36) with device_open and needed an app's barcode scanner to read a barcode PNG. The hub launches the emulator with -camera-back imagefile:~/.cache/serve-emu/camera/emulator-5554-back.png, and that file held the hub's checkerboard placeholder. The app's camera showed neither the checkerboard nor any image the agent supplied. It showed the emulator's built-in fake camera scene, so the image-file camera was never in effect. The agent then tried adb emu virtualscene-image and rotating the virtual device, which changed nothing, and the barcode was never read.

Diagnosis

T3 checks which camera modes the emulator supports once per device hub process, so the result goes stale when the emulator is updated while T3 runs.

  • hubEnvironment (LocalDeviceHost.ts#L212-L235) runs emulator -help-camera-front and -help-camera-back. When the output lacks imagefile, it adds -camera-<facing> emulated to EXPO_DEVICE_HUB_EMULATOR_EXTRA_ARGS.
  • expo-device-hub 0.22.1 puts its own -camera-<facing> imagefile:<feed> first and the extra args after them, so emulated replaces the image-file camera.
  • hubEnvironment is only called from spawnHub (L440), which runs on first start (L713) and after the hub exits (L514). ensureHubReady reuses a live hub (L673-L682), so booting a device never re-runs the check.

Timeline on this machine (UTC, 2026-11-20):

  • 11:57:17: the hub started while the SDK had Emulator 36.5.10. The check found no imagefile: the 11:57:52 boot command includes the emulated overrides, which the check adds only in that case. (36.5.10 also crashed at boot here, which is unrelated.)
  • 11:59:27: the emulator was updated to 37.3.10, whose -help-camera-back lists imagefile:<filename>.
  • Boots after that, the last at 13:35, still showed the fake camera. The same hub process still has the emulated overrides in its environment.

The SSH host doesn't have this problem: sshDeviceScript.ts#L201-L210 recomputes the camera args on every start and restarts the hub when emulatorExtraArgs changed. The local host could do the same, but restarting the hub while an emulator is booted needs a decision.

Steps to reproduce

  1. Use an Android SDK whose emulator -help-camera-back does not list imagefile (Emulator 36.5.10 here).
  2. Start T3 and open an AVD from the Device panel or device_open, so the device hub starts. The boot itself does not need to succeed.
  3. Without restarting T3, update the emulator to a version that lists imagefile:<filename> (37.3.10 here).
  4. Boot the AVD again from T3.
  5. Expected: the emulator gets only -camera-back imagefile:…. Actual: -camera-front emulated -camera-back emulated is appended after it, and the camera shows the emulator's fake camera scene instead of ~/.cache/serve-emu/camera/emulator-5554-back.png (the hub's checkerboard placeholder by default).

Version

0.1.11-nightly.20261118.4864 (LocalDeviceHost.ts unchanged on main @ df09ced)

Environment

Fedora Linux 44 x64 (kernel 7.2.15), Node v26.13.1, t3 serve with the web client in Firefox, local device host, expo-device-hub 0.22.1, agent-device 0.21.36, Android Emulator 36.5.10 then 37.3.10

Evidence

# device_open at 11:57:52Z with Emulator 36.5.10 (the boot failed with SIGSEGV, unrelated)
~/Android/Sdk/emulator/emulator -avd Pixel_9_Pro -no-audio -no-window -no-metrics -gpu auto -no-boot-anim -port 5554 -camera-back imagefile\:~/.cache/serve-emu/camera/emulator-5554-back.png -camera-front imagefile\:~/.cache/serve-emu/camera/emulator-5554-front.png -camera-front emulated -camera-back emulated

# Device hub process, started 11:57:17Z and still running hours later
$ tr '\0' '\n' < /proc/<hub pid>/environ | grep EMULATOR_EXTRA
EXPO_DEVICE_HUB_EMULATOR_EXTRA_ARGS=-camera-front emulated -camera-back emulated

# The emulator binary was replaced after the hub started
$ ls -l --time-style=full-iso ~/Android/Sdk/emulator/emulator
-rwxr-xr-x. 1 user user 10144992 2026-11-20 13:59:27 +0200 ~/Android/Sdk/emulator/emulator
$ ~/Android/Sdk/emulator/emulator -version
Android emulator version 37.3.10.0 (build_id 16970787) (CL:N/A)
$ ~/Android/Sdk/emulator/emulator -help-camera-back
     emulated             -> camera will be emulated using software ('fake') camera emulation
     ...
     imagefile:<filename> -> Camera will render an image file.

# After stopping the hub at 13:56Z, T3 started a new one without the overrides
$ tr '\0' '\n' < /proc/<new hub pid>/environ | grep EMULATOR_EXTRA
(no output)

# Next device_open boot (14:00Z): only the hub's image-file camera flags
$ tr '\0' ' ' < /proc/<emulator pid>/cmdline | grep -o -- '-camera-[a-z]* [^ ]*'
-camera-back imagefile:~/.cache/serve-emu/camera/emulator-5554-back.png
-camera-front imagefile:~/.cache/serve-emu/camera/emulator-5554-front.png

Related issues

None found. I searched issues and PRs for emulator camera, imagefile, camera-back emulated, EXPO_DEVICE_HUB_EMULATOR_EXTRA_ARGS and device hub. #37953 also changes hub startup on Linux, but it is about the adb server.

Fix applied or workaround

Stopped the device hub process (kill <hub pid>) while no emulator was booted. T3 started a new hub within seconds, and the check ran again without adding the overrides. The next device_open boot got only the image-file flags. The stock Camera app showed the hub's checkerboard placeholder, and after a barcode PNG was written to the feed file and the app reopened, it showed the barcode. Restarting T3 should also work, but it ends running sessions.

Filed by

Claude Code (Claude Opus 5.5) via t3 triage

— Claude Opus 5.5, on behalf of Tiaxi

Activity

  1. added
    via-triage
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions