6
votes

I'm testing my camera app on Samsung J7 Pro which have front flash (real hardware LED flash). When I'm checking front flash available with the deprecated Camera API using:

List<String> supportFlashModes = defaultParameters.getSupportedFlashModes();
boolean isSupportedFlashMode = (supportFlashModes != null && supportFlashModes.contains(Camera.Parameters.FLASH_MODE_ON));

it works properly, the supported flash modes return 4 values (on, off, auto_flash, always_flash) for front camera.

But when I'm checking with the new Camera2 API using:

Boolean b = characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
boolean isSupportedFlashMode = b != null ? b : false;

isSupportedFlashMode always return false for front camera. And if I check the supported flash modes using:

characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES);

it's also return only 2 values (ae_on, ae_off).

Does anyone know how to solve this? Note that I've just want to check the availability of device's front flash Thank you.

Update

These methods worked fine on my Q-Mobile device (which also have a real LED front flash), but still not working on Samsung J7 Pro. I don't know why?

1
I am finding J7 device to answer ^^ - Tung Tran
@AlexCohn I've ready tried to use their Samsung galaxy SDK, but it built on top of camera2, and not work on my J7 pro too. I will try to borrow another J7 pro to test it tonight. - nhoxbypass
For this front camera, is CameraCharacteristics.get(INFO_SUPPORTED_HARDWARE_LEVEL) == INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY ? - Alex Cohn
@AlexCohn No, I've already disable camera2 for device which have hardware supported level == LEGACY. :( - nhoxbypass
Another question: you receive the wrong answer when you ask camera2 if the front flash is available; but can you manipulate this flash via camera2? Or you must simply put J7Pro on the blacklist of devices that pretend to have camera2, but require the old Camera API to work reliably? - Alex Cohn

1 Answers

4
votes

It seen to be a device related issues. My company app which using camera2 API also faced the same problem.

I've already try to test it with a simple sample and OpenCamera but none of them worked. Then I decided to hold this bug till now because the number of devices that have front flash is small and most of them worked fine.