FlashAvailabilityChecker

@RequiresApi(21) class FlashAvailabilityChecker
kotlin.Any
   ↳ androidx.camera.camera2.internal.compat.workaround.FlashAvailabilityChecker

A workaround for devices which may throw a java.nio.BufferUnderflowException when checking flash availability.

Summary

Public methods
static Boolean
isFlashAvailable(@NonNull characteristics: CameraCharacteristicsCompat)

Checks whether the camera characteristics advertise that flash is available safely.

Public methods

isFlashAvailable

static fun isFlashAvailable(@NonNull characteristics: CameraCharacteristicsCompat): Boolean

Checks whether the camera characteristics advertise that flash is available safely.

Parameters
characteristics CameraCharacteristicsCompat: the characteristics to check for CameraCharacteristics#FLASH_INFO_AVAILABLE.
Return
Boolean the value of CameraCharacteristics#FLASH_INFO_AVAILABLE if it is contained in the characteristics, or false if it is not or a java.nio.BufferUnderflowException is thrown while checking.