I made an app a while ago that changes the ring mode whenever certain paople call. So, when one of those people call, it changes the ring mode to make the call ring at full volume. I use
setRingerMode(AudioManager.RINGER_MODE_NORMAL)
am.setStreamVolume(AudioManager.STREAM_RING, am.getStreamMaxVolume(AudioManager.STREAM_RING), 0);
The app also changes the interrupt filter to INTERRUPTION_FILTER_ALL, but to make things easier, let's assume that Do Not Disturb isn't enabled. So, for example, if the phone was set to vibrate, when there is an incoming call from a matching contact, it switches the ringer on, and sets the volume to max.
Everything worked fine before I got a phone with Marshmallow (Nexus 6P). Now, if there is an incoming call, my app changes the ring mode and volume as usual, but the incoming call doesn't get affected. It still behaves the same way, even thought the ringer settings got changed. I can verify that my app is defnintely making the changes -- after the call is finished, the ring volume settings are exactly as they should be. And if another call comes in, that one rings properly. It just seems like the ring mode changes aren't being applied to an incoming call that's already in progress.
Does anyone have anu suggestions as to what's changes in Marshmallow that's causing this, and if there is a way around it?