I have recently encountered something that caused me to pull out half of my hair off.
I have tried to access the audioManager and to set a new mode like this:
mAudioManager.setMode(AudioManager.MODE_NORMAL);
With some reason which, in that time, i didnt understand the audioManager refused to set the new mode.
Only after a hours of debugging and trying everything that i had in my sleeves, I discovered that I`m accessing the audio manager from another part in my app, but with an Activity context, and not with the Application context, which was what i used before.
It seems that when acquiring the AudioManager, you "steal" its access with the new Context from the other context that it is assigned to.
You`ll find the fix in the answer.
If you found this helpful, please consider voting for this this who inspired me.