Security: how to prevent USB mounting of mobile device
Try this from adb shell on your PC or from a root terminal on your device:

content update --uri content://settings/secure --bind name:s:mount_ums_autostart --bind value:i:0


Per the Android source code:

/**
 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
 * @hide
 */
public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";