Work on issue #9586838: Crash after waking up Hammerhead device

I made the power manager more rigid, not allowing different uids
to use the same wake lock.  This never should happen.  I would
guess there is somewhere that the activity manager is acquiring
the wake lock without clearing the calling identity...  but it is
hard to follow all the paths this may happen in.  So here we add
some checks when acquiring/releasing the wake lock to make sure
it is being done as the system uid.

Also:

- Protect the new activity stack calls with a permission, and
make sure to clear the calling uid once past that.
- Collect uid data from process stats so we can correctly
associate CPU use with a uid even if we don't know about the
pid for some reason.
- Fix battery stats dump commands to clear calling uid before
executing so they aren't broken.

Change-Id: I0030d4f7b614e3270d794ecfc3669139a5703ce9
8 files changed