Clean up some braces and formatting
Fix buiding db detection (thanks, prodroiding!) and clean up the formatting
Autoformat everything to Android guidelines.
Hopefully this will make eventual Canvas merge easier.