Plug-in for Locale (which is not free) to detect whether the power source is USB or other (AC/car charger/dock). Can't distinguish between non-USB sources, but you can use other plugins to detect docks.
Needs Android 2.2+ & Locale which isn't free.
Apparently fails on Motorola Droid but I don't have one to test.
Tags: locale power source plugin , locale power , locale source , plugins , google , detect ac power , locale plugin to detect car or home charger , locale close ap when power unplugged