After updating my Nexus 5 to Marshmallow I started encountering a strange issue. When listening to music/podcasts the voice search activated frequently and prompted: “To do a Google Voice search, please unlock your phone“. If I would walk with my phone in the pocket this would sometimes happen every 2 seconds, which was extremely frustrating.
I spent several hours trying to find a software fix, but even though the problem seems to have been around for years there is still no official fix. My research revealed that the problem is that my phone thinks I’m using a headphone with a built in cable mic. I’m using regular headphones with a TRS plug though. I could have purchased different headphones to fix the problem, but I really like my current headphones and didn’t want to buy new ones.