Open r0d0dendr0n opened 1 year ago
Yes, I think there are some new permission issues with Android 13 (compared to Android 12 and earlier), which I haven't had time to take a closer look at yet. At least with Pixel 6, a reboot helps. You could try that with your device as well.
I'm not quite sure what you mean with "system voice recognition feature". You could try to use that with with "Kõnele service" (https://github.com/Kaljurand/K6nele-service/releases), instead of Kõnele.
Reboot didn't help. I'm now going to try the Kõnele service.
Sorry for not being specific enough. By "system voice recognition feature" I meant the thing that happen after I click the voice input button on the tv remote control. The system then shows the Kõnele voice input window and should display the recognized text as I speak. If you guide me I can gather more data that may explain it better.
I have uninstalled Kõnele and LocalSTT. Installed the Kõnele service using the apk fetched from the link you provided. After that android tv is unable to use voice search - it says that the application for this function is not installed.
Next I installed Kõnele from F-droid and selected "Kõnele service" as the recognition service - it behaves exactly like the LocalSTT service. The Kõnele app window flickers and displays "[ insufficient permissions ]". I also tried after manualy giving all possible permissions through the system settings / applications - sound and music, files, pictures and the fetch url and run its content to Kõnele and checking that the Kõnele service has the permission to use the microphone.
OK, thanks for these details! Make sure "Settings -> Privacy -> Microphone access" is enabled. You could also try to check a few things:
Otherwise I have no idea at the moment, as there are many components what can fail here: Android 13, LineageOS, Android TV, the remote control's voice input button, Kõnele, etc.
It seems the voice input button launches the ASSIST intent, which is resolved to Kõnele's SpeechActionActivity
(this is an activity dialog panel that is provided by Kõnele, not Kõnele service, i.e. you'd need to have Kõnele installed):
01-03 19:32:36.316 555 2523 I ActivityTaskManager: START u0 {act=android.intent.action.ASSIST flg=0x13200000 cmp=ee.ioc.phon.android.speak/.activity.SpeechActionActivity (has extras)} from uid 10034
01-03 19:32:36.389 555 591 I ActivityManager: Start proc 6926:ee.ioc.phon.android.speak/u0a87 for next-top-activity {ee.ioc.phon.android.speak/ee.ioc.phon.android.speak.activity.SpeechActionActivity}
At the first launch the activity asks for the RECORD_AUDIO permission or verifies that it has the permission. If it has the permission then it calls the RecognitionService (e.g. Kõnele service, or LocalSTT, or Google, whatever has been selected as the default in the Kõnele settings). The service must also have the permission, but in this case it does not (or perhaps the permission is blocked centrally).
01-03 19:32:37.667 2451 2451 I RecognitionService: caller doesn't have permission:android.permission.RECORD_AUDIO
I will of course try all the things, but currently I'm away from the androidtv device. In the mean time I have tried Kõnele + localstt with Samsung Galaxy Tab S8 with Android 13 One UI 5 (up to date stock fw, not rooted), behaviour is the same as on AndroidTV. I guess this mean that the issue is android 13 specific, not lineage or androidtv specific.
I will also try Kõnele service on the tablet and let you know.
I've checked Kõnele + LocalSTT on my PocoF1 with Lineage 17.1 (android 10) - works like a charm.
OK, thanks for these details! Make sure "Settings -> Privacy -> Microphone access" is enabled.
Yes, Settings -> Privacy -> Mic access is enabled for app apps and services. There is also an entry to check apps with mic access. Both Kõnele and LocalSTT is on that list. No installed apps are forbidden to use the mic.
You could also try to check a few things:
- does speech input work in the Kõnele keyboard?
I selected "Kõnele speak & swipe" in Settings -> System -> Keyboard -> Current keyboard. Then I clicked on a text input so the keyboard would be raised up. After clicking the veeery lonely mic icon (the bottom panel is very big and that icon sits on the right, but the rest of the panel is empty) I get the same error message: "[ insufficient permissions ]" in the upper left corner of the app panel. No flickering though.
(I get a striked text "K6_Y_BTN_MIC_LONGPRESS" or "K6_Y_BTN_MIC_DOUBLETAP" in the same place as the above error, when I do a long press or double tap of the OK button.)
* does speech input work when Kõnele is launched via its launcher icon (or via an other app, e.g. Maps, ...)
When I click the Kõnele icon from the launchers app list I get a window titled "Speak a web search query". I get the flickering "[ insufficient permissions ]" error.
When I try the voice input option for f.e. youtube I get the same error as when I clicked the icon from the launchers app list.
* does speech input work via Google's service (which for LineageOS, you can get via GApps, I guess), or any other speech recognition provider?
Yes! When I select select "Kõnele fast recognition" (with no language indication) as a recognition service I get some text output to the things I say. I guess it returns Estonian?
I don't have GApps on this device. That's my whole point of using Kõnele :-).
* does a basic sound recorder app work?
Yes, all apps I tried are working fine with my mic.
Thanks for testing! It's curious that "Kõnele (fast recognition)" works. (It's basically the same service as "Kõnele service", the only difference is that it's part of the Kõnele app itself.)
One idea behind installing GApps, is that maybe it unlocks some features (or avoids some system bugs), and as a result things start working also in other apps. But I can understand that installing GApps is not an option for various reasons.
So, at the moment I'm out of ideas. I'll open separate issues for things that I've noticed on Android 13, and try to fix these (although I cannot promise quick fixes), hoping that this issue will also go away as a result.
Tbh it wouldn't be too much trouble to backup my pi's mmc, get rid of microg, flash gapps, test, report back and restore backup if you believe it's worth a shot. Sounds like a fun evening in the upcoming week.
I have removed all traces of microg. Then I've installed the "basic" version of NikGapps from https://sourceforge.net/projects/nikgapps/files/Releases/NikGapps-T/08-Sep-2022/ . I also tried the same process with the "full" version. All of them are described here: https://nikgapps.com/downloads . They support Android 13 ("T"), but no notes if it's the same package for Android tv. The Installation process went well, with a couple of apps (Android Auto, Calendar, and some other, not related to speech or assistant) skipped, due to insufficient space on my device (root is only 2gb). The rest was installed fine, although the Play Store says my device is not supported. Contacts, calculator or gmail seems to work.
After installing Gapps I tried Kõnele. The behaviour of the app is exactly the same as before with LocalSTT and "Kõnele fast recognition", both when using the assistant button on the remote or the android keyboard (AnySoftKeyboard) voice input feature. Then I Installed Google Speech Services apk and rebooted. There was no additional entry in Kõnele recognition services list.
I guess I'm restoring my sdcard now.
Thanks for testing! I'm out of ideas now, and don't have a similar setup to test myself. One hope is that fixing a related issue, e.g #99 will fix this issue as well. (However, it's unlikely that I'll have time in the coming months to work on this, beyond reviewing merge requests by others.)
Small update: I've installed https://github.com/ewheelerinc/LocalSTT/releases/tag/2022-01-18-en-US on my Pixel 6 (Android 13, T2B2.221216.006), and set Settings -> System -> Languages & input -> Speech -> Voice input
to Kaldi/Vosk Recognizer
. After giving it mic permissions, the app works via its launcher icon, i.e. one can dictate and see the resulting (English) transcription.
It does not work via Kõnele. Typically the Kõnele mic button turns grey and stays like this, and there is no Kõnele-level error message. Sometimes there is the system pop-up "LocalSTT keeps stopping".
Perhaps the problem is with the service configuration:
<service
android:name=".VoskRecognitionService"
android:process=":speechProcess"
android:icon="@drawable/ic_service_trigger"
android:label="@string/vosk_recognition_service"
android:permission="android.permission.RECORD_AUDIO">
One should add:
android:exported="true"
android:foregroundServiceType="microphone"
And at the manifest root level:
<queries>
<intent>
<!-- Packages that provide speech recognition services -->
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
The newest LocalSTT fork seems to be https://github.com/parolteknologio/AndroidParolRekono
I've tested the APK from https://github.com/parolteknologio/AndroidParolRekono/releases/tag/2022_julio and it works via Kõnele as well. :)
Its Manifest does not export the service either, but it does contain the block:
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
so perhaps this is enough.
Hi, I also have issues with Android 13 (but ~not~ on Samsung mobile hardware, not TV.) To be exact, I just can't find the menu point to choose the default-speech-recognition service (Which was in previous version within the Assistent menu). I also had a look into Settings -> System -> Languages & input -> Speech -> Voice input
But within voice input I only find a menu to choose downloading offline speech, which I guess is provided by google or Samsung. I can not switch to any other speech recognition. Am I in the correct menu?
And offtopic, but for completeness: I was pointed to your app because I try to make an in-app-implementation of vosk available to the system-speech-recognition-provider. However, this issue occurs with both (konele and dicio/vosk) implementations. As a general question: Do you plan to support more languages / offline speech recognition? Since yours is already a well-working stand-alone-app for providing speech recognition, developing a complete new stand-alone app would not make much sense but would not be neccessary either :)
@nebkrid, I assume you meant "on Samsung mobile hardware"? In any case, your issue does not seem to have anything to do with permissions (the topic of this thread) but the availability of system settings, which perhaps differ across vendor customizations of Android, e.g. on Pixel 6 / Android 13, I'm seeing both the Assistant and the speech input menus.
Regarding support for more languages / offline services, the plan is to keep Kõnele just a UI app (the dark yellow boxes in the diagram in https://github.com/Kaljurand/K6nele/blob/master/README.md), that interacts with speech services via the SpeechRecognizer-interface. These services would be developed by other independent projects, and can be multi- or monolingual, cloud-based or offline (e.g. based on Vosk or Whisper).
@Kaljurand thank you very much for your answer and sorry for my late reply. Your answer really helps me a lot since so it seems that this is not a general Android 13 issue (that's why I added it to this topic, since I was so confused about this "Android 13" behaviour that I guessed it still might be related with some missing permissions or manifest entries) but a specific Samsung implementation (yes you guessed correct: I indeed meant on Samsung hardware.)
I'm trying to run K6nele 1.8.14 from F-Droid with LocalTTS rebuilt to include the Polish speech model on my Android TV 13 (Lineage) running on raspberry pi 4. LocalTTS runs fine and recognizes speech, but will not put recognized text in any text input field (out of scope of this issue). This is where K6nele comes in. LocalTTS is recognized in K6nele as Kaldi/Vosk Recognizer and I'm able to select it as the used recognition service. So far so good.
When I use the system voice recognition feature on any text field I get a weird behaviour of the K6nele voice input window - it goes into a some kind of a loop and displays "[ Insufficient permissions ]" while flickering.
Logcat contains:
What cought my attention is the line:
RecognitionService: caller doesn't have permission:android.permission.RECORD_AUDIO
. I checked both apps (K6nele, LocalTTS) in the Application settings for Mic permissions. I've also tried to manually grant the android.permission.RECORD_AUDIO to both packages, but no results. Any tips what to check or try?