Skip to content

Commit 6dd128b

Browse files
committed
fix: do not turn on the flashlight when decreasing it while the flash is turned off
1 parent e446fb2 commit 6dd128b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

app/src/main/java/io/github/sds100/keymapper/system/camera/AndroidCameraAdapter.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ class AndroidCameraAdapter(context: Context) : CameraAdapter {
152152
return Error.SdkVersionTooLow(minSdk = Build.VERSION_CODES.TIRAMISU)
153153
}
154154

155+
// If the flash is disabled and it should be decreased then do nothing.
156+
if (percent < 0 && isFlashEnabledMap.value[lens] == false) {
157+
return Success(Unit)
158+
}
159+
155160
try {
156161
val cameraId = getFlashlightCameraIdForLens(lens)
157162

0 commit comments

Comments
 (0)