Hello!
My HTC One M9 progressively stopped recognizing my headphones. I first checked for lint - just in case but it was clean as a whisle!
After 1 month of not working, I contacted HTC, they asked that I do a reboot in Safe Mode, then try the headphones to be sure it wasn't another app doing...