In Android 5.0 and up (from what I've noticed), unplugging a jack device triggers a "volume reset" that lowers the audio output volume. Upon increasing the volume, a toast
message appears stating the risk of listening to music at high volumes.
Upon some research, this is as a result of EU regulation. I don't know if this affects US devices, but I would like to know how to prevent the "volume reset" behaviour, as I find it particularly frustrating.