Volume Button Issue

I noticed that the volume button of the Xperia X compact (model F5321, Build number 34.3.A.0.252, Android version 7.1.1) (for other phones please check) is fully operational even when the phone is locked.More precisely, if a stranger pushes the power button he has access to your volume button even if his fingerprint isn't recognized by the phone. Unfortunately, by default the volume button is linked to the Ring and notification volume and therefore, this stranger could decrease your ringing volume to zero even when the phone is locked. If you know a way to either:i) link the volume button to the Media Volume instead of the Ring and notification volume; orii) completely disable the phone volume button when the phone is lockedplease let me know.Thank you in advance.