-
Notifications
You must be signed in to change notification settings - Fork 33
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
App crashes when attempting to set volume #250
Comments
According to the documentation for the setStreamVolume call it can throw an exception on N or higher if the app is not granted do-not-disturb access if the call would trigger toggling do-not-disturb. I just got an N device so I will see if I can replicate this. |
Thanks for helping. Let me know what you find. |
What kind of device was this? The only ways I have been to generate the same exception are with a demo app that sets the notification volume instead of the music stream volume - or by using an android tv emulator (because the music and notification streams are the same on an android tv device). In any case the same issue appears here with a solution that the settings page where the user can enable the DND override: OpenLauncherTeam/openlauncher#67. Also need to add permission android.permission.ACCESS_NOTIFICATION_POLICY. |
I think you need the fix when not ramping the volume also. Also you probably should just ignore the security exception in the ontick method because you don't want to start an activity possibly multiple times. |
Good points. I will make those changes. |
java.lang.SecurityException:
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at android.media.IAudioService$Stub$Proxy.setStreamVolume(IAudioService.java:961)
at android.media.AudioManager.setStreamVolume(AudioManager.java:1340)
at a2dp.Vol.service.setVolume(service.java:1027)
at a2dp.Vol.service$7.onFinish(service.java:694)
at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:127)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method:0)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
The text was updated successfully, but these errors were encountered: