Or in software (Linux):
# cd /sys/bus/usb/devices
# for n in usb* ; do echo 0 >$n/authorized_default ; done
...so that no drivers or userspace programs are allowed to communicate with any newly connected devices.https://www.kernel.org/doc/Documentation/usb/authorization.t...
Of course this only prevents the USB host, you'd have to disable all USB-gadget daemons on your android phone to not have the charger tinker with the phones's data.
NOTE/added: I just realized that the main purpose this is marketed is to protect the phone's data. I'd me more worried about the computer if someone asks me to lend some juice...