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

Crash when opening sound panel while Do Not Disturb is activated #67

Closed
TheLastProject opened this issue Apr 24, 2017 · 5 comments
Closed
Assignees
Labels

Comments

@TheLastProject
Copy link

Build version: 0.3.1
Build date: 1980-01-01 00:00:00
Current date: 2017-04-24 15:29:49
Device: Motorola XT1524

Stack trace:
java.lang.SecurityException: Not allowed to change Do Not Disturb state
at android.os.Parcel.readException(Parcel.java:1684)
at android.os.Parcel.readException(Parcel.java:1637)
at android.media.IAudioService$Stub$Proxy.setStreamVolume(IAudioService.java:830)
at android.media.AudioManager.setStreamVolume(AudioManager.java:1071)
at com.benny.openlauncher.util.LauncherAction.RunAction(LauncherAction.java:131)
at com.benny.openlauncher.activity.Home$11.onItemClick(Home.java:595)
at android.widget.AdapterView.performItemClick(AdapterView.java:310)
at android.widget.AbsListView.performItemClick(AbsListView.java:1164)
at com.balysv.materialripple.MaterialRippleLayout$PerformClickEvent.clickAdapterView(MaterialRippleLayout.java:658)
at com.balysv.materialripple.MaterialRippleLayout$PerformClickEvent.run(MaterialRippleLayout.java:642)
at com.balysv.materialripple.MaterialRippleLayout$3.onAnimationEnd(MaterialRippleLayout.java:336)
at android.animation.AnimatorSet.onChildAnimatorEnded(AnimatorSet.java:829)
at android.animation.AnimatorSet.-wrap1(AnimatorSet.java)
at android.animation.AnimatorSet$AnimatorSetListener.onAnimationEnd(AnimatorSet.java:784)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1153)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1313)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.-wrap2(AnimationHandler.java)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:872)
at android.view.Choreographer.doCallbacks(Choreographer.java:686)
at android.view.Choreographer.doFrame(Choreographer.java:618)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6128)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

@BennyKok
Copy link
Member

OH no.... crash again.....

@BennyKok BennyKok added the bug label Apr 24, 2017
@BennyKok BennyKok self-assigned this Apr 24, 2017
@ghost
Copy link

ghost commented May 6, 2017

I am pretty sure this happens because of missing permissions (since API 23).When DND is activated the and the App doesn't have the permissions, it should ask for it.

I replaced the VolumeDialog in LauncherAction.java with. It works but after the permission was granted you have to press the VolumeDialog button again, because I dont't know how to wait for the asyncronous permission call:

case VolumeDialog:
                if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
                    try {
                        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
                        audioManager.setStreamVolume(AudioManager.STREAM_RING, audioManager.getStreamVolume(AudioManager.STREAM_RING), AudioManager.FLAG_SHOW_UI);
                    } catch (Exception e) {
                        NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
                        if (!mNotificationManager.isNotificationPolicyAccessGranted()) {
                            Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
                            context.startActivity(intent);
                        }
                    }
                } else {
                    AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
                    audioManager.setStreamVolume(AudioManager.STREAM_RING, audioManager.getStreamVolume(AudioManager.STREAM_RING), AudioManager.FLAG_SHOW_UI);
                }
                break;

@BennyKok
Copy link
Member

BennyKok commented May 6, 2017

Thanks leo, I just don't have the time to fix them all at a time, so some issue is being put aside when I am fixing something else, ha ha. Maybe you pull an request and I do the permission callback to reactivate the volume dialog?

@ghost
Copy link

ghost commented May 6, 2017

I won't rush you! And I dont't have a clue about java and android development. That's why I don't want to bother you with creepy code pull requests. I'll just hang around here in the issue queue trying to help and maybe get into this a little...

@BennyKok
Copy link
Member

BennyKok commented May 7, 2017

Ha ha ok then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants