XamarinCommunityToolkit
XamarinCommunityToolkit copied to clipboard
[Bug] CameraFlashMode.Auto creates massive overexposure on Android
Description
I use the CameraFlashMode.Auto in my app but on some devices it creates a massive overexposure which results in an almost complete white image.
Steps to Reproduce
- Open CameraView
- Set CameraFlashMode to Auto
- Trigger the Shutter Command
Expected Behavior
CameraView takes a picture under usage of the flash and i get a image with decent lighting, just like in the regular camera app on the device.
Actual Behavior
CameraView turns on the devices flash, takes an image and i get an almost white image Other Devices work fine.
Basic Information
-
Version with issue: 1.0.0-pre5
-
Last known good version: -
-
IDE: Visual Studio Enterprise 2019 Version 16.8.0
-
Platform Target Frameworks:
- Android: Target SDK 29
-
Affected Devices: Samsung Galaxy S7 edge, Android 8 (SDK 26)
Workaround
None
Reproduction imagery
Result Image with CameraFlashMode = Auto
Result Image with CameraFlashMode = Off

Very interesting. I do see you're using 1.0.0-pre5 is there a reason you didn't update yet? Could you confirm this also happens on the latest stable package?
Also I think I see you mentioning "certain devices" what are devices that this is happening on and what are devices where it doesn't happen on? What is the difference between these two? Is there any code involved that might be of influence?
If you could attach a small reproduction project that would be super helpful!
Our project is on Xamarin Forms 4.8, so we used the 1.0.0-pre5. Nonetheless I updated XF and the CommunityToolkit to the latest stable version, but the images still look the same.
I have two devices for testing:
- Samsung SM-A605N with Android 10 (API 29): Error doesn't occure here
- Samsung Galaxy S7 edge (Samsung SM-G935F) with Android 8 (API 26): Error occures here
I'm not sure about the differences in hardware between these two devices but there ist no code which differences between them. As I mentioned in the expected behavior, the default camera app works fine with Flash On/Auto.
Unfortunately I am not able to share the actual project, but I just deployed the latest sample project to the device and got the same results:
Flash on:

Flash off:

We seemingly have the exactly same issue in our Android app.
Default device app seems to wait longer before taking a photo, gradually applying image correction over approx. 1 second, then takes a photo when image whiteness is corrected. The result picture looks good and natural
When using CameraView, it doesn't apply any image corrections and the result picture looks white-ish and not as natural, almost completely white on one device.
We used different Android devices - some of them seemed to work better than others, but this issue existed for all of them.
Any updates regarding this bug?