Improve the handling of KEYCODE_HEADSETHOOK