Custom PictureCallback camera does not start if flash is used on S4 devices

I wrote a basic user camera that I recently changed to use the flash (if available) on the device. As soon as I made the change, the code worked fine, as before, on my HTC One Mini 2, but no longer worked on my Galaxy S4. After I went through, I found that my jpeg callback was never reached on S4, an unhandled callback was being executed, but with a null byte [].

I found this similar question: Problem with S4 Flash

Which, apparently, confirms the presence of a problem and a solution on these devices, but the solution has not been documented.

For repeated iteration, the code works fine on S4 until I turn on the flash drive with:

Camera.Parameters p = mCamera.getParameters();
p.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);//Or FLASH_MODE_ON
mCamera.setParameters(p);

Can anyone with experience working on these devices provide a solution?

+2
source share
1 answer

After many trial and error over the past week, I came across two possible solutions to this problem, the first of which makes no sense to me:

  • Forced scaling will be greater than x1. For some reason, if I set the scale to x1.2, etc., the camera works again, as I expected.

  • , . S4 1920x1080, , 16: 9, . , , , getSupportedPictureSizes() ( , , .)

2 . , S4 , / /, .

+2

All Articles