Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- Open the Device panel on an Android emulator that has a hinge sensor but is not showing a foldable inner display. For example, the
Resizable_ExperimentalAVD in its Phone mode (1080×2400). - Switch to the 3D view (cube button in the controls rail).
Expected behavior
The 3D model keeps the frame's real aspect ratio. Either the regular Android phone model is used, or the frame is letterboxed inside the fold model.
Actual behavior
The foldable model is shown with a nearly square inner screen, and the phone-shaped frame is stretched across it. Text and UI come out about 2× too wide.
Cause
Having a hinge is taken to mean that the frame is a fold inner display:
apps/web/src/components/device/deviceHubAtoms.tssets a fold angle whenever/vendor/serve-emu/api/foldreturnssupported: true.packages/client-runtime/src/device/phoneViewer.ts(around lines 110–122) buildscreateAndroidFoldScenewhenever an Android device has a fold angle, whatever the frame's aspect ratio.foldAspectis the frame's aspect only whenisFoldInnerAspect(0.75–1.5) holds. Otherwise it falls back toDEFAULT_FOLD_INNER_ASPECT(2076/2152 ≈ 0.96).packages/client-runtime/src/device/androidFoldScene.tssizes the panel from that aspect (halfWidth = innerAspect * screenHeight / 2 + INSET). It maps the whole texture edge to edge (UVs 0..1 in the screen-geometry loop and insetDisplayfor the cover screen), so any mismatch shows up as stretching.
A 1080×2400 frame (0.45) drawn on a 0.96 panel is stretched about 2.1× horizontally. Tablet mode (1920×1200 = 1.6) also falls outside the range and gets the default panel.
A related problem is in updateLayout: innerChanged = isFoldInnerAspect(frameAspect) && frameAspect !== foldAspect. When the frame leaves the fold range, for example when the resizable emulator switches from Foldable to Phone, the fold scene is neither rebuilt nor replaced and keeps the old aspect.
The same assumption applies to real foldables that are showing their cover display while reporting a hinge. The cover screen is also sized from halfWidth, not from the frame.
Possible fix
- Use the fold scene only while the frame aspect is fold-like. Otherwise fall back to
createPhoneScene, and switch between the two inupdateLayoutwhen the frame crosses the range. - Or keep the fold scene and fit or letterbox the texture to the frame aspect in the inner and cover screen UVs.
- Regression test: in
phoneViewer.test.ts, set a fold angle and a 1080×2400 source, then assert that the phone scene is used or that the screen aspect stays 0.45.
Impact
Minor bug or occasional failure
Version or commit
0.1.6-nightly.20261031.3956 (code checked at main d92c437; phoneViewer.ts and androidFoldScene.ts are unchanged on main since #19559)
Environment
Web client on Windows 11; Android Resizable_Experimental emulator on a device host
Workaround
Switch the resizable emulator to Foldable mode, or use the 2D view.
Written by Claude Code (Claude Opus 5.5) at the reporter's request.
Activity