Repository navigation
Conversation
Physical cameras inside a logical multi-camera always reported `type: 'unknown'`. Type them by the diagonal field of view of their shortest focal length, computed from their own LENS_INFO_AVAILABLE_FOCAL_LENGTHS and SENSOR_INFO_PHYSICAL_SIZE, with the VisionCamera 4 thresholds: above 94 degrees ultra-wide-angle, 60 to 94 wide-angle, below 60 telephoto. If those characteristics are missing, the type stays `unknown`. Adds a Harness test that checks the type of each physical device of a virtual device, and skips when there is none.
|
@Rubenkl is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
@mrousavy, a small Android fix for The workflows are waiting for approval because this is my first PR here. Could you approve them so CI can run? Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On Android, every entry in
CameraDevice.physicalDevicesreportstype: 'unknown'.CameraInfo+deviceType.ktreturns early for aPhysicalCameraInfoAdapter, with a TODO that says the adapter throws onintrinsicZoomRatio.This also affects the
physicalDevicesfilter ofuseCameraDevice(...)andgetCameraDevice(...). A logical camera loses a point for every'unknown'lens, so a standalone camera at the same position always wins. On the Samsung layout from #4038, the triple filter from the docs returns the standalone ultra-wide instead of the triple camera.Fix
A physical camera is now typed by its own diagonal field of view, like VisionCamera 4 did in
CameraDeviceDetails.getDeviceTypes(). It uses the shortestLENS_INFO_AVAILABLE_FOCAL_LENGTHSentry andSENSOR_INFO_PHYSICAL_SIZEfrom the physical camera'sCameraCharacteristics, whichHybridPhysicalCameraDevicealready reads forfocalLength. Above 94 degrees isultra-wide-angle, 60 to 94 iswide-angle, and below 60 istelephoto. Without those characteristics it still returnsunknown. Standalone and logical cameras are unchanged.I did not switch to
intrinsicZoomRatio. In CameraX 1.7.0-alpha03 it no longer throws on a physical camera, so the TODO is outdated. It divides the horizontal view angle of the default camera at that position by this camera's, both truncated to whole degrees, and the result is not rounded. With the strict< 1fcheck, a main lens one degree wider than the default camera would come out asultra-wide-angle.Test
visioncamera.devices.harness.tsgets one case: each physical device of a virtual device must report aPhysicalDeviceType, which are the types thephysicalDevicesfilter can match. It skips when there is no virtual device.I ran it on an Android 16 (API 36) arm64 emulator started with
-camera-back emulated -camera-front emulated. Its front camera1is a logical camera of physical cameras4(4.38 mm on a 5.64 x 4.23 mm sensor, about 78 degrees) and5(5.84 mm on a 4.66 x 3.50 mm sensor, about 53 degrees).main: fails withexpected [ 'ultra-wide-angle', …(7) ] to include 'unknown'.4reportswide-angleand camera5reportstelephoto.The existing "does not expose unknown fallback values" test checks for the same
'unknown'. On this emulator it already fails earlier, on a top-level device'ssupportedPixelFormats, so it never reaches the physical devices. That failure is the same onmainand on this branch. The rest of the Harness suite also fails the same way on both builds on this emulator, apart from the flaky "applies the initial torchMode prop" test in the camera-view suite.Also ran:
bun camera typecheckbun run buildandbunx tsc --noEmit -p apps/simple-camera/tsconfig.jsonbun lint-jsbun lint-kotlin(ktlint 1.8.0, no changes)./gradlew assembleDebug -PreactNativeArchitectures=arm64-v8ainapps/simple-camera/androidNotes
intrinsicZoomRatio. I left that path alone to keep this change small.Prepared with an AI coding assistant. I reviewed the change, and the emulator run was done on my machine.