Skip to content

Conversation

@MdAyan101
Copy link

Summary

@MdAyan101 MdAyan101 mentioned this pull request Jul 4, 2025
@jineshfrancs
Copy link

jineshfrancs commented Jul 5, 2025

Flash light issue(#518) resolved with this fix, Thanks @MdAyan101

@ac5865
Copy link

ac5865 commented Jul 7, 2025

#518 I was also facing the same issue, and was able to resolve using this. Thanks

@DavidBertet
Copy link
Contributor

Hi @MdAyan101,

Thanks for your first contribution!

If you want it to be merged quickly, please proactively provide details

  • why is the fix addressing the issue, the explanation behind it or a doc. Should this "trick" be done elsewhere?
  • steps on how you tested it, what version etc.

This helps now to get it merged, but also in the future to have enough context so it doesn't get mistakenly reverted

@MdAyan101
Copy link
Author

Hi @DavidBertet ,

I was facing the issue of toggling the flashlight through a button while camera preview was on. I was not able to turn on the flash since the camera was already in use and I was getting this exception :
android.hardware.camera2.CameraAccessException: CAMERA_IN_USE (4): setTorchMode:3108: Torch for camera "0" is not available due to an existing camera user

So I changed the setTorchMode method adding a pause for camera preview and then enabling the flash and then again resuming the camera preview. Just 2 line added.

I tested this in android 11, 12, 13, 14, 15 devices. Devices were from Samsung, pixel, Motorola, one-plus and it works for every device.

@scarlac
Copy link
Collaborator

scarlac commented Aug 27, 2025

@MdAyan101 I am unable to reproduce the issue with a Pixel Fold 9. Can you provide an example project or a video recording of the issue? I don't want to add one-off hacks like this without a clear use cause.

@scarlac
Copy link
Collaborator

scarlac commented Sep 12, 2025

Can you have a test of v16? It fixes a bunch of issues with the new arch so it's possible it affected it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants