I was reading a bunch of news articles which asked not to charge phone using public USB ports as they could be malicious.

According to the web pages, the USB wires carry data and power so they have a capacity to infect your phone or steal the data. Is there no protection in Android against it?

What about the option on Android phones to use a phone for just charging or transferring data when connected to computer?

  • 1
    Use an USB cable with no data lines, i.e. for charging only. – Steffen Ullrich Aug 29 '17 at 18:24
  • @SteffenUllrich that is definitely doable. I am wondering if there is a software based solution (Maybe a kernel module or something). There may very well not be and using a USB cable with no data lines could be the most feasible solution. I will not deny that – Limit Aug 29 '17 at 18:39

Android has this feature now.

Go into either
Settings > System > About phone
Settings > About phone.
Inside About phone tap on Build number about 7 times. Navigate back to Settings at the top of the screen and enter 'developer' into the Search View. From the search results you'll need to follow the Developer options link. Inside Developer options flip the switch at the top to On and then scroll down and tap Select USB Configuration. In the dialog select a configuration from the options, and you're all set. To help prevent attacks from malicious chargers you would generally set the configuration to Charging.

  • 1
    Does this always work? If it does, then yes. It does solve the problem – Limit Aug 30 '17 at 23:32
  • Yeah, it works every time. It can get annoying having to confirm each time you connect ADB. – andDevW Aug 31 '17 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.