So I built my own custom keyboard, currently adding Speech-to-Text functionality.
Using SpeechRecognizer class: https://developer.android.com/reference/android/speech/SpeechRecognizer
I have added <uses-permission android:name="android.permission.RECORD_AUDIO" />
permission in manifest, which is used by older devices.
Newer devices need to ask such a permission on the fly, before using it.
If I request "RECORD_AUDIO" permission, everything works.
If I don't request it, I get error code "9", which means "SpeechRecognition won't work because permission was not supplied".
Makes sense.
However, I installed Googles Gboard virtual keyboard, and there clicking on record button, it just starts, without asking for permission. WHY?
I also checked in gboards settings, I haven't given it permission to use microphone, yet it just... does use it.