Added some android debug output. Improve android shutdown logic.