Battery aware sleeps.

Sleep for longer when not connected to a battery source. Tested for
Android, recent Linux, and OS X.