Wake-word service does not give microphone control to other apps
Description
Once Dicio installed and the service has been started, your input always goes to the app even if it is asleep (not running in foreground).
I receive a call, the caller on the other end will not hear anything until Dicio is stopped completely (force stop) on my phone.
Specs
Device: Bluejay [GrapheneOS] Android: 14 Dicio: v2.0 (All features including Wake word was enabled)
It is true that Dicio keeps the microphone active, however the system should automatically take care of giving microphone control to other apps that request it. That's what happens on my phone and on emulators, so it might be a bug of your OS. I don't think there is a way to fix this, I couldn't find any documentation online for audio recording focus (but only for playing audio focus). If anyone finds something please let me know, but be aware that AudioManager.OnAudioFocusChangeListener only refers to playing audio, not recording audio.
I'm not that into Android OS these days. @thestinger might have some info this?
It's definitely not a GrapheneOS issue which doesn't make any changes to how this works. It will almost certainly happen on the stock Pixel OS. The app needs to be tested on devices using Android 15 QPR1 or the upcoming QPR2. Non-Pixel devices don't have the latest Android releases. Android 15 isn't the latest.
I just tested on an Android emulator with API 35 (without Google APIs) and as soon as I start a call, Android gives control to the phone app (as shown in the image below) and takes it away from Dicio (making the wakeword not work anymore), but when the call finishes Dicio is again able to react to wakewords. I also tested with this audio recording app and observed the same behavior.
However, these results are quite inconsistent. Sometimes Dicio when opens on the emulator, it captures audio focus only for a brief instant and then only gets values of 0 from the AudioRecord object. When that happens, the phone app and the audio recording app do acquire the microphone focus, but they also always receive values of 0. This clearly seems like a bug in the OS, or in the layer that emulates the microphone in the OS, so I don't know if it's related to the various issues related to the wake word like this one.
@pixincreate could you collect logs from this APK? https://github.com/Stypox/testing-apks/releases/tag/10 It will log when the wakeword service starts receiving only 0s and when it does not. Also include logs from other apps since they may contain some useful information on why the focus is not transferred correctly.
I need some time for this. Will update with logs. adb logcat should be fine, right?
Yes, thanks :-)