Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android 13 #9

Open
ran-haim opened this issue Sep 25, 2022 · 13 comments
Open

android 13 #9

ran-haim opened this issue Sep 25, 2022 · 13 comments

Comments

@ran-haim
Copy link

ran-haim commented Sep 25, 2022

The service does not seem to work on android 13.
For example, when hitting the microphone on google maps nothing happens.
Same behavior in other apps.

@ran-haim ran-haim changed the title android 12 android 13 Sep 26, 2022
@Kaljurand
Copy link
Owner

If possible can you provide more details (e.g. screenshots, screencasts).

I'm using Android 13 myself, and in principle it works, but I have observed the following regressions, which I haven't had time to debug yet (and which might be more relevant for the Kõnele project, rather than Kõnele-service).

  • sometimes the recognition results are not passed on to the caller app (e.g. Chrome, Maps). Also, when starting recognition from the Kõnele launcher icon, the recognition succeeds but the web browser with the results is not opened.
  • after globally disabling the mic access and then enabling it again, Kõnele (or Kõnele-service) fails to regain the access (at least rebooting the device restores the access)
  • Google app's supported languages are not visible anymore and cannot be selected. I guess this has something to do with https://developer.android.com/about/versions/13/behavior-changes-all#speech-service

@ran-haim
Copy link
Author

ran-haim commented Sep 28, 2022

Hi,
I don't think a screenshot will give any further information - when I press the microphone button nothing happens.
Also I would like to say that I am actually running it under GrapheneOS (based on android 13) - google voice provider works though.

@Kaljurand
Copy link
Owner

Maybe it's a permissions issue. Try to make sure that both Kõnele-service and Kõnele have the microphone permission, and perhaps also reboot the device. The error message about the missing permission is not always shown. I think this used to work better with earlier versions of Android.

@ran-haim
Copy link
Author

I managed to get the k6nele popup appear, but when I press the microphone button in the popup - it says insufficient privileges.
Both apps have microphone privileges.
Do they need anything else?

@Kaljurand
Copy link
Owner

They shouldn't need anything else. I'm out of ideas at this point. On my Pixel it works, I have no experience with GrapheneOS.

@ran-haim
Copy link
Author

ran-haim commented Oct 1, 2022

is there a way to take a look in the log?

@Kaljurand
Copy link
Owner

You can try to run adb logcat, when the device is connected to the computer (see https://developer.android.com/studio/command-line/adb) and grep for messages related to "k6nele". Possibly you need to compile Kõnele/Kõnele-service from source to have the debug-messages enabled.

@ElishaAz
Copy link

ElishaAz commented Feb 15, 2024

I'm adding a RecognitionService to Sayboard.
While trying to testing it with Konele on Android 13, I got the ERROR_INSUFFICIENT_PERMISSIONS (code 9).

The only way I could find to bypass it, is by adding the QUERY_ALL_PACKAGES to the RecognitionService (it seems that SpeechRecognition class tries to look for the calling package and gets an error, and therefore assumes that it doesn't have the right permissions).

Might help here too.

@Kaljurand
Copy link
Owner

I think you don't need QUERY_ALL_PACKAGES if you only need to query for the speech recognizers. I've actually removed the request for this permission in Kõnele in Kaljurand/K6nele@790f73e because otherwise Google Play refuses to accept updates to the app.

So now the queries are the following (https://github.com/Kaljurand/K6nele/blob/2ff612790153e3cd2249f1a39abe66c7c3a3f31c/app/src/main/AndroidManifest.xml#L86C2-L100C1) and things seem to work.

   <queries>
        <intent>
            <!-- Packages that provide speech recognition services -->
            <action android:name="android.speech.RecognitionService" />
        </intent>
        <intent>
            <!-- Packages that provide TTS services -->
            <action android:name="android.intent.action.TTS_SERVICE" />
        </intent>
        <intent>
            <!-- This seems to be needed to be able to show the labels and icons of apps, queried by package name. -->
            <action android:name="android.intent.action.MAIN" />
        </intent>
    </queries>

I think Kõnele-service does not need any queries because it does not query for other services.

@ElishaAz
Copy link

I did some more testing, and it seems that the only reason you don't get this error is because Konele exports a RecognitionService, and speechutils (which konele-services uses) queries for RecognitionService's, which means that konele-services has permission to query for konele. If you comment out either the RecognitionService's in konele or the queries tag in speechutils in konele-services, you get the ERROR_INSUFFICIENT_PERMISSIONS in konele (even though both have the microphone permission) when konele-services is selected in the settings.

Tested on and Android 13 emulator, and on Crdroid 9.10 (Android 13).

@Kaljurand
Copy link
Owner

I added the queries-block to the manifest of speechutils in
Kaljurand/speechutils@813533c but now I'm not sure it needs to be there, because speechutils is a library and one might only use some of its functionality, and if it does not include querying for speech recognition providers then one would not want to "inherit" the related queries.

You are saying that "konele-services has permission to query for konele", but it's the other way around: Kõnele depends on Kõnele-service as an optional runtime dependency, but Kõnele-service has no dependency on Kõnele. So I'm a little confused...
Also, above you write "adding the QUERY_ALL_PACKAGES to the RecognitionService", but the query permission is an app level thing, i.e. does not pertain to individual services.

Are you saying that something should be done on the Kõnele/Kõnele-service/speechutils side to make ElishaAz/Sayboard#54 work?

In any case, nice work on Sayboard and I'm looking forward to the resolution of ElishaAz/Sayboard#54

@ElishaAz
Copy link

You are saying that "konele-services has permission to query for konele", but it's the other way around: Kõnele depends on Kõnele-service as an optional runtime dependency, but Kõnele-service has no dependency on Kõnele. So I'm a little confused...

Yes, It's also the other way around. But I found out that (at least in my case) if the service can't query for the caller, It immediately returns ERROR_INSUFFICIENT_PERMISSIONS (before my code is even called), regardless of the microphone permission.

Also, above you write "adding the QUERY_ALL_PACKAGES to the RecognitionService", but the query permission is an app level thing, i.e. does not pertain to individual services.

I meant to the app that exports the RecognitionService (konele-services or Sayboard).

Did you try removing the queries-block from speechutils in konele-services or commenting out the RecognitionServices in the manifest of konele?

As I said earlier, for me this results with ERROR_INSUFFICIENT_PERMISSIONS in konele.

@Kaljurand
Copy link
Owner

You are right, K6nele-service must have the queries block for the RecognitionService. I've lifted it from speechutils to K6nele-service in 16be0bd but removing it completely would result in INSUFFICIENT_PERMISSIONS (in the latest Android 14). (I don't understand why...)

Still, QUERY_ALL_PACKAGES should not be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants