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

App crashes when attempting to set volume #250

Closed
jroal opened this issue Jul 14, 2017 · 6 comments
Closed

App crashes when attempting to set volume #250

jroal opened this issue Jul 14, 2017 · 6 comments

Comments

@jroal
Copy link
Owner

jroal commented Jul 14, 2017

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)

@cprhokie
Copy link
Collaborator

cprhokie commented Oct 7, 2017

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.

@jroal
Copy link
Owner Author

jroal commented Oct 7, 2017

Thanks for helping. Let me know what you find.

@cprhokie
Copy link
Collaborator

cprhokie commented Oct 13, 2017

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.

@jroal
Copy link
Owner Author

jroal commented Oct 14, 2017

Thanks for finding this. I implemented that fix in 2.12.9.2. I was never able to duplicate this issue so I have no way to test the fix.

Here is more info on this issue:
image
It looks like all Samsung devices but then again, Samsung sells the most Android devices.

I just pushed 2.12.9.2 to Alpha on the Play Store. Please test this and let me know the results.

@cprhokie
Copy link
Collaborator

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.

@jroal
Copy link
Owner Author

jroal commented Oct 15, 2017

Good points. I will make those changes.

@jroal jroal closed this as completed Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants