GrapheneOS / Camera

Modern camera app focused on privacy and security with QR & barcode scanning.
https://grapheneos.org/
MIT License
826 stars 87 forks source link

Make handling system microphone access block/unblock more user friendly #346

Closed girlbossceo closed 10 months ago

girlbossceo commented 1 year ago

Currently if your microphone access is blocked and you try to record with audio enabled, the camera will start recording (timer will start) and you will get a system notification to allow access to the microphone. Either allowing or disallowing the prompt will throw "error code 4" with the video recording failed to save, and you will need to manually unblock microphone access from the quick tile / settings.

See linked video recording (video recording is over 10MB). Could not find any Java exceptions or clear errors in logcat, but the line 02-22 20:21:01.362 1609 11226 E AppOps : Operation not started: uid=10096 pkg=app.grapheneos.camera(null) op=RECORD_AUDIO is very consistent when this happens.

https://photos.app.goo.gl/UtK9G2YaXbPkQH3RA

girlbossceo commented 1 year ago

The intended result should be not starting the recording until the user either unblocks or blocks it through the system prompt. If the user rejects it, the recording will cancel and a more user friendly snackbar should show saying the user needs to unblock microphone access or disable audio recording.

empratyush commented 1 year ago

Could not find any Java exceptions or clear errors in logcat

java.lang.IllegalStateException: The audio source has been silenced.
  at androidx.camera.video.Recorder$5.onSilenced(Recorder.java:1647)
  at androidx.camera.video.internal.AudioSource$AudioRecordingApi29Callback.lambda$onRecordingConfigChanged$0$androidx-camera-video-internal-AudioSource$AudioRecordingApi29Callback(AudioSource.java:245)
  at androidx.camera.video.internal.AudioSource$AudioRecordingApi29Callback$$ExternalSyntheticLambda0.run(Unknown Source:4)
  at androidx.camera.core.impl.utils.executor.SequentialExecutor$1.run(SequentialExecutor.java:111)
  at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:231)
  at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:173)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
  at java.lang.Thread.run(Thread.java:1012)

IMO this is what causing the error.

girlbossceo commented 1 year ago

Strange I wasn't able to find that, but yes that'd probably be the Camera app not handling that.