this is a common problem with htc m7 & m8 they use a focus motor and get damage from motorcycle vibration or high shocks. i had the same problem on my m7 and m8, i took the phone to the supplier and i got new one instead.
now am using different phone when riding