startBluetoothSco() 在 ICS 上抛出安全异常 (BROADCAST_STICKY)

发布于 2024-12-23 14:25:25 字数 1866 浏览 2 评论 0原文

我有一个由 ICS 用户发送的堆栈跟踪。

在我的 Froyo 设备上,一切工作正常,但当调用 AudioManager.startBluetoothSco() 时,用户显然会收到权限拒绝... 我不知道为什么会发生这种情况 - 我知道 ACTION_SCO_AUDIO_STATE_CHANGED 的广播是粘性的,但它不是发送它的应用程序,所以它不应该需要权限...

下面是堆栈跟踪:

java.lang.SecurityException: Permission Denial: broadcastIntent() requesting a sticky 
broadcast from pid=15341, uid=10064 requires android.permission.BROADCAST_STICKY
at android.os.Parcel.readException(Parcel.java:1327)
at android.os.Parcel.readException(Parcel.java:1281)
at android.media.IAudioService$Stub$Proxy.startBluetoothSco(IAudioService.java:1090)
at android.media.AudioManager.startBluetoothSco(AudioManager.java:975)
at de.bulling.smstalk.libs.utils.AudioUtils.startBluetoothSco(AudioUtils.java:164)
at de.bulling.smstalk.Services.TTS.speakIt(TTS.java:151)
at de.bulling.smstalk.Services.TTS.onInit(TTS.java:83)
at android.speech.tts.TextToSpeech.dispatchOnInit(TextToSpeech.java:627)
at android.speech.tts.TextToSpeech.access$1000(TextToSpeech.java:52)
at android.speech.tts.TextToSpeech$Connection.onServiceConnected(TextToSpeech.java:1279)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1068)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1085)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

/edit: 我可以重现这个问题,无论我是否使用 START_STICKY 启动服务都没有关系。

I have a stacktrace sent in by a user with ICS.

On my Froyo device everything is working fine, but the user apparently gets the Permission Denial when AudioManager.startBluetoothSco() is called...
I have no idea why this is happening - I know the Broadcast for ACTION_SCO_AUDIO_STATE_CHANGED is sticky, but it is not the app that is sending it, so it should not need the permission...

Below is the stacktrace:

java.lang.SecurityException: Permission Denial: broadcastIntent() requesting a sticky 
broadcast from pid=15341, uid=10064 requires android.permission.BROADCAST_STICKY
at android.os.Parcel.readException(Parcel.java:1327)
at android.os.Parcel.readException(Parcel.java:1281)
at android.media.IAudioService$Stub$Proxy.startBluetoothSco(IAudioService.java:1090)
at android.media.AudioManager.startBluetoothSco(AudioManager.java:975)
at de.bulling.smstalk.libs.utils.AudioUtils.startBluetoothSco(AudioUtils.java:164)
at de.bulling.smstalk.Services.TTS.speakIt(TTS.java:151)
at de.bulling.smstalk.Services.TTS.onInit(TTS.java:83)
at android.speech.tts.TextToSpeech.dispatchOnInit(TextToSpeech.java:627)
at android.speech.tts.TextToSpeech.access$1000(TextToSpeech.java:52)
at android.speech.tts.TextToSpeech$Connection.onServiceConnected(TextToSpeech.java:1279)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1068)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1085)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

/edit: I could reproduce the issue, and it doesn't matter if I start the service with START_STICKY or not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

〆凄凉。 2024-12-30 14:25:25

唯一的解决方法是将此权限添加到您的应用程序以使其在 ICS 上运行。

<uses-permission android:name="android.permission.BROADCAST_STICKY"/>

记录了一个问题 在 OHAP 上查看 ICS 中的此缺陷

Only workaround is to add this permission to your app to get it working on ICS..

<uses-permission android:name="android.permission.BROADCAST_STICKY"/>

There is an issue logged here on OHAP for this defect in ICS

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文