squashed-many commits fixes from android source