Android 5.0 includes a new way to control which applications can interfere with your device: when you press the volume button, the pop-up window now allows you to select No (completely silent), Priority (only priority-based notifications sound) or All (all is allowed to make noise.)

I want my application to be able to request a device to find out which of these three modes is active, and also I would like to be able to change these modes (without requiring the device to be deployed). Does anyone know how to do this?
So far, I can find a short link in this change log :
Setting the device to RINGER_MODE_SILENT forces the device to switch to the new priority mode. The device exits priority mode if you set it to RINGER_MODE_NORMAL or RINGER_MODE_VIBRATE.
This works as described, which allows me to very restrict the ability to change the priority mode by changing the call mode
source share