fix: Fix minFocusDistance
being NaN
on some emulators
This commit is contained in:
parent
8c66d36d8f
commit
e95264f782
@ -102,6 +102,7 @@ class CameraDeviceDetails(val cameraManager: CameraManager, val cameraId: String
|
|||||||
private fun getMinFocusDistanceCm(): Double {
|
private fun getMinFocusDistanceCm(): Double {
|
||||||
val distance = characteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE)
|
val distance = characteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE)
|
||||||
if (distance == null || distance == 0f) return 0.0
|
if (distance == null || distance == 0f) return 0.0
|
||||||
|
if (distance.isNaN() || distance.isInfinite()) return 0.0
|
||||||
// distance is in "diopters", meaning 1/meter. Convert to meters, then centi-meters
|
// distance is in "diopters", meaning 1/meter. Convert to meters, then centi-meters
|
||||||
return 1.0 / distance * 100.0
|
return 1.0 / distance * 100.0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user