ubports / ubuntu-touch

Ubuntu Touch's issue inbox is now migrated to GitLab.
https://gitlab.com/ubports/ubuntu-touch
1.29k stars 110 forks source link

First time granting access to microphone, breaks microphone for all other apps too (qt 5.12 issue?) #1668

Closed luksus42 closed 3 years ago

luksus42 commented 3 years ago

Devices: Nexus 5, Fairphone 3, BQ e4.5 Channel: dev

I assume this happens since QT 5.12 update. If your html5-app or Morph-Browser for example, already did have permission to use the microphone or are in the permissions-list displayed at least, then everything works as expected.

Expected Behavior

Current Behavior

Here is a test html5 app: html5rectest.zip

related: https://github.com/luksus42/soundrecog/issues/6 maybe related: ubports/morph-browser#455 , ubports/morph-browser#399

dobey commented 3 years ago

I don't think this is related to Qt 5.12. Even on stable, Recorder app is not asking for mic permissions on my E4.5. The mic permissions request in Morph also never completed for me. In System Settings, microphone permissions is only showing Guitar Tools as having requested permission.

After reboot, I was able to grant mic permission to Recorder. I started recording, paused, and then switched to Morph and opened a video call page to test. It asked for permissions in the browser, but did not open the system permissions request, and failed to complete the request. I switched back to Recorder, and unpaused the recording, which resulted in some odd audio playback and recording feedback loop, which persisted until I switched back to Morph, where it again popped up the in-browser request and not the system request. So I think Morph is doing something wrong and perhaps causing the trust service to crash or such.

luksus42 commented 3 years ago

Thanks for your quick answer @dobey . So something other must have changed in the last two weeks...

Edit: Hm no, on RC (week 50 in 2020) and stable (OTA-15) it is the same behavior...

peat-psuwit commented 3 years ago

Ok, so turns out the problem is a bit complicated.

It seems like the Chromium version used in the current QtWebEngine now issues a recording in a child process instead of the main process (perhaps this changes in QtWebEngine 5.12 -> 5.14.). This causes Mir, when being requested a prompt session, to unable to match the recording pid to the opened session.

This should results in the request being simply denied, but the reason it hangs is that it's the prompt itself that hangs. The trust store daemon ignores the error and proceeding with launching the prompt provider, which fails to connect to Mir and then hangs. This hang cascade all the way to Pulseaudio, which is the reason why future audio recording also fails.

As this isn't exactly Morph Browser's problem (and it probably also happens with other QtWebEngine users), I'll transfer this issue to ubports/ubuntu-touch.

luksus42 commented 3 years ago

Thanks for the quick look into it.

Are there already some changes in dev? I just discovered, that my test-app is now displayed in the app-microphone-permissions-site in system settings. So I could grant the access to the app and now it is working.

peat-psuwit commented 3 years ago

Merged ubports/trust-store#14 allows other apps to request microphone after Morph Browser fails to, but doesn't fix the issue with the Morph Browser itself.

Flaburgan commented 3 years ago

Merged ubports/trust-store#14 allows other apps to request microphone after Morph Browser fails to, but doesn't fix the issue with the Morph Browser itself.

When trying with jitsi meet for example on https:/framatalk.org/morph-test there is progress though: before I wasn't able to actually join the room, the screen being stuck on "Please allow access to your microphone" even after saying yes to the prompt. Now when I say yes I reach the room but jitsi still complains it can't reach my mic.

UniversalSuperBox commented 3 years ago

Since the issue with Morph blocking access to the microphone for all other apps has been solved and the issue with Morph being unable to access the microphone is filed as https://github.com/ubports/morph-browser/issues/399, I will close this report.

For QA: The issue went as follows:

  1. Start with morph-browser not having asked for microphone input (for example, a newly reset device)
  2. Attempt to use the microphone with morph-browser
  3. Note that the trust-store request for microphone access never appears and the webapp's request never completed (it would still say "waiting for microphone access" usually)
  4. Open another app which has never used the microphone before, and get it to bring up its request (for example, open the Recorder app and try to record a voice message)

The prompt for the Recorder app would never appear. A reboot was required to give access to Recorder.

Now, the webapp's request for microphone access will complete with a denial, and it will be possible to grant access to the other app.

dadandalive commented 3 years ago

I confirm that after a fruitless attempt of Morph to get access to the microphone (went to voicechanger.io, replied affirmative to browser's request for domain access to microphone, still saw 'please enable microphone' button without receiving a secondary system permission request, and kept the page open as such), other apps still can be granted access to the microphone (tried with freshly installed 'guitar tools' app).

I didn't manage to reset my device settings to standard values (~ reset request freezed settings app, without resetting any settings), but in any case Morph wasn't listed among the apps with microphone access (in system's privacy settings) nor was any domain already listed (in Morph's own privacy settings) as having access to the microphone.

Tested on Nexus 5 RC 2021-W10.

Flohack74 commented 2 years ago

@dadandalive this should finally be fixed, plz give it a try...

Flaburgan commented 2 years ago

Using today's development build on the pinephone, it looks like https://framatalk.org/test still isn't able to access my microphone.

peat-psuwit commented 2 years ago

Huh, have the trust-store prompt ever worked on Pinephone, given that it uses Wayland for the whole stack? Can other applications request microphone on Pinephone?

Flaburgan commented 2 years ago

The trust prompt is here, it asks me to grant access to the camera and then to the microphone, I do, and then the website says that an unknown error blocked them to access the mic.

Flaburgan commented 2 years ago

I had the same behavior with my FP2 when it was running UT. It is now running /e/ OS so I can't test anymore sorry.

ivoxavier commented 2 years ago

Hi,

I've tested on the FP2 with the click app provided in the description and after granting access to microphone it did not broke the apps that I've previously, and still able to record voice messages on TELEports and Recorder App.

Tested was performed on Devel channel: image from (2021-11-12).

UniversalSuperBox commented 2 years ago

The PinePhone has never worked with trust-store, and instead allows all requests to microphone.

luksus42 commented 2 years ago

This specific issue is solved. Other errors like not appearing trust-prompts or errors on mic-recording in browser or webview should be handled in separate issues. (https://github.com/ubports/morph-browser/issues/399 for example... should be reopened btw.)