Fix bugs with granting permissions through onNewIntent().

It would grant the permission to the temporary ActivityRecord,
not the real one, so it never got cleaned up.

Also allow granting of permissions to services because...  well,
it would be really really useful.  And it introduces some
refactoring that we'll need to support cut/paste.

Change-Id: If521f509042e7baad7f5dc9bec84b6ba0d90ba09
7 files changed