Skip to content

fix: store shared screen frames in emulator-approved temp directory - #25

Merged
Wolklaw merged 1 commit into
Wolklaw:mainfrom
Dirt2939:fix/shared-frame-temp-directory
Nov 22, 2026
Merged

Wolklaw merged 1 commit into
Wolklaw:mainfrom
Dirt2939:fix/shared-frame-temp-directory

Conversation

@Dirt2939

Copy link
Copy Markdown
Contributor

Android Emulator 37.3.10 rejects file-backed shared memory outside its permitted temporary directories. AndroidBox currently creates .frame files in its data directory, leaving the main screen blank even though Android boots successfully and instance thumbnails work.

The emulator log reports Rejected shared memory handle for those files.

This change stores shared frames under tempfile.gettempdir()/AndroidEmulator, prefixes their names with androidbox-, and creates the directory before opening the memory-mapped file. The existing fallback to regular image transport is retained if file creation fails.

Validation:

  • Reproduced the blank main screen on Windows 11 with AndroidBox 1.12.1, Android 16, and Android Emulator 37.3.10.
  • Confirmed the Android home screen appears after applying the fix and running AndroidBox from source.
  • Ran the 1.12.1 test suite with the fix: 101 tests run, 99 passed and 2 skipped.

Other operating systems have not been manually tested.

@Wolklaw
Wolklaw merged commit 7965f49 into Wolklaw:main Nov 22, 2026
Wolklaw added a commit that referenced this pull request Nov 22, 2026
… frame file

Fixes #26. Builds on #25: the frame folder now lives in paths.FRAMES, deleting an
instance cleans up frames there (and old ones in the data folder), and if no
shared-memory frame arrives within 5 seconds the screen is streamed as plain
images instead of staying blank.
@Wolklaw

Wolklaw commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Thanks for tracking this down and for the clear write-up, the emulator log line made it easy to confirm. Merged and released in 1.12.2. I added a small follow-up on top: the frame folder now lives in paths.FRAMES, deleting an instance also cleans up frames there, and if no shared frame arrives within 5 seconds the screen falls back to plain images, so Linux or a future emulator change won't leave it blank.

@Wolklaw Wolklaw mentioned this pull request Nov 22, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants