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?
CameraCharacteristics.get(INFO_SUPPORTED_HARDWARE_LEVEL) == INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY? - Alex Cohn