Skip to content

[Bug]: Flashlight does not handle camera use conflicts with other apps #267

@sameerasw

Description

@sameerasw

Trying to toggle flashlight during the camera is being used by another app causes a crash leading to a lot of issues including the accessibility service getting detached. This need to be handled gracefully.

"last_crash_log": "Crash Time: 2026-03-04 00:09:02.239\nThread: main\nException: CameraAccessException\nMessage: CAMERA_IN_USE (4): setTorchMode:3184: Torch for camera \"0\" is not available due to an existing camera user\nStack Trace:\nandroid.hardware.camera2.CameraAccessException: CAMERA_IN_USE (4): setTorchMode:3184: Torch for camera \"0\" is not available due to an existing camera user\n\tat android.hardware.camera2.utils.ExceptionUtils.throwAsPublicException(ExceptionUtils.java:75)\n\tat android.hardware.camera2.CameraManager$CameraManagerGlobal.setTorchMode(CameraManager.java:2857)\n\tat android.hardware.camera2.CameraManager.setTorchMode(CameraManager.java:1562)\n\tat ib.f.d(r8-map-id-5dcaa71295e741bbea837022a04158e3d13cd9f4c20cfa22e9ab1b21dc743f98:285)\n\tat ha.j.invokeSuspend(r8-map-id-5dcaa71295e741bbea837022a04158e3d13cd9f4c20cfa22e9ab1b21dc743f98:452)\n\tat qb.a.resumeWith(r8-map-id-5dcaa71295e741bbea837022a04158e3d13cd9f4c20cfa22e9ab1b21dc743f98:9)\n\tat hc.j0.run(r8-map-id-5dcaa71295e741bbea837022a04158e3d13cd9f4c20cfa22e9ab1b21dc743f98:111)\n\tat android.os.Handler.handleCallback(Handler.java:1095)\n\tat android.os.Handler.dispatchMessageImpl(Handler.java:135)\n\tat android.os.Handler.dispatchMessage(Handler.java:125)\n\tat android.os.Looper.loopOnce(Looper.java:269)\n\tat android.os.Looper.loop(Looper.java:367)\n\tat android.app.ActivityThread.main(ActivityThread.java:9333)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:566)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)\n\tSuppressed: mc.e: [q1{Cancelling}@8499889, Dispatchers.Main]\nCaused by: android.os.ServiceSpecificException: setTorchMode:3184: Torch for camera \"0\" is not available due to an existing camera user (code 7)\n\tat android.os.Parcel.createExceptionOrNull(Parcel.java:3384)\n\tat android.os.Parcel.createException(Parcel.java:3354)\n\tat android.os.Parcel.readException(Parcel.java:3337)\n\tat android.os.Parcel.readException(Parcel.java:3279)\n\tat android.hardware.ICameraService$Stub$Proxy.setTorchMode(ICameraService.java:1329)\n\tat android.hardware.camera2.CameraManager$CameraManagerGlobal.setTorchMode(CameraManager.java:2854)\n\t... 14 more\n\n\n--- Last Logs before crash ---\n",

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions