我们创建了一个使用 Google 语音识别器的 Android 应用程序,我们首先在程序中选择使用 Google 语音识别器。大多数设备工作正常,只有少数设备(MEIZU_M5、U78-E、Apollo Lite 等)报告以下异常。好像和联发科的语音指令有些冲突?我们发现其他一些联发科的设备工作正常。这令人困惑。
java.lang.SecurityException: Not allowed to bind to service Intent { act=android.speech.RecognitionService cmp=com.mediatek.voicecommand/.service.VoiceWakeupRecognitionService }
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1421)
at android.app.ContextImpl.bindService(ContextImpl.java:1385)
at android.content.ContextWrapper.bindService(ContextWrapper.java:604)
at android.speech.SpeechRecognizer.startListening(SpeechRecognizer.java:287)
要追溯代码,源代码只显示到 ContextWrapper.java。如何让它显示到 ContextImpl.java:1421?
通过 firebase 日志,我们发现它发生在许多 3rd 方语音识别器中:
com.mediatek.voicecommand
com.htc.android.voicedictation
com.vlingo.midas
com.iflytek.speechcloud
com.iflytek.speechsuite
...
我们还测试了其他一些运行良好的第 3 方语音识别器。那些导致异常的语音识别器是否仅用于系统语音命令而无法访问应用程序?
欢迎任何想法或经验。