-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Upgrade VisionCamera to V4 #37483
Conversation
@Beamanator Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
(note; we are still testing this here in our office with the test devices - I'll report back with all devices tested in a few hours) |
Thanks! I can review when this is ready since I am reviewing the stale v3 PR as well. |
Hold on we found an error on Android - marked this PR as draft, will fix it and ping you once it's ready again! |
Status update: We are still encountering the error where CameraX fails to start. I am talking to Google about this, this might actually be a bug in CameraX. 😓 |
fadaf1a
to
599c6d3
Compare
Update: I think I fixed the "Camera failed to start" blocker error in VisionCamera v4.0.0-beta.7! Testing in Expensify app now.. |
Let us know when you want us to generate AdHoc builds for testing |
I've managed to upload the videos by cropping and compressing them, probably low network issues. As I mentioned earlier, the first time black screen still comes up on Android. But we've decided to create a new issue for that. |
Cool! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a separate issue for the bug
@mananjadhav I think we're good to go now? |
Yes. I think we need to sync the latest main to get rid of the failing performance action ? |
Yeah normally I wouldn't care about that flakey check, but maybe it's a good idea given this is an important library change |
Tested with beta 11, works well on all devices we have in the office! |
@Julesssss All yours. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks all
@Julesssss looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
There was not a failing test 😖 |
🚀 Deployed to staging by https://github.com/Julesssss in version: 1.4.58-0 🚀
|
I think this introduced a regression here: #39241, basically the sound profile on Android isn't consistent with the settings both in OS and app-level. |
I suspect this may have introduced this regression as well #39285. In this version of the app, the Android camera shows a black screen when attempting to SmartScan a receipt. |
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.58-8 🚀
|
Details
As many of you might've noticed, the upgrade to VisionCamera V3 took quite a long time already and eventually still wasn't merged because of a few blockers:
SurfaceTexture
APIs for the video pipeline, andOutputConfiguration
APIs for the Capture Session that were introduced in SDK 26 or 23 respectively. Adding backwards compatibility here was painful and required a lot of effort.if (manufacturer == "SAMSUNG")
🙄)if (manufacturer == "SAMSUNG")
🙄)A bit of important backstory around V2 vs V3:
In VisionCamera V2 I used CameraX, which abstracted most of those quirks away, but back then (a year ago) was still insanely limiting and couldn't support all the features that VisionCamera had.
So in VisionCamera V3 I switched over to Camera2, the lower level Camera framework for Android where you have to do everything manually (e.g. capturing a photo requires an AF, AE, AWB precapture sequence, listen to status changes, manually override flash control, and only then you can capture photo metadata), and while that meant MUCH more complexity it also meant much more control and features.
Using Camera2 also gave me a great understanding of how Cameras work under the hood, and I noticed that a lot of vendors (e.g. Samsung) didn't implement the Camera HAL specification properly so I'd have to do a bunch of workarounds to avoid crashes, blackscreens or even full device reboots.
After adding workaround after workaround I decided to look into CameraX again - and to my surprise it actually did quite good over the last year. They added a ton of features, and have a bunch of those device specific quirk workarounds implemented already.
Also, they already have features like deferred surfaces and 10-bit HDR for video capture which I wanted to implement myself (those are really complex, HDR requires loading EGL OpenGL extensions).
So for VisionCamera V4 we're switching over to CameraX again. I kinda see it like this:
So yea - in short; this PR upgrades to VisionCamera V4 (currently in beta).
I will do a few more breaking changes in VisionCamera V4, but none of them will affect the expensify codebase (they're mostly for the video pipeline)
Also I promise I'll fix it in Expensify if I introduce a breaking change to VisionCamera V4 😄
Fixed Issues
$ #28341
PROPOSAL: #28341 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android