Send package to permission check

While splitting the permissions from the package manager service,
we adjusted the implementation of checkUidPermission() which queried
for package objects separately from obtaining the package names
belonging to a UID. This caused some subtle timing issue where the
package object sometimes failed to be present.

Instead, send the affected package while in a sycnhronized block
to avoid the timing issue.

Fixes: 68260103
Test: Manual
Change-Id: I0b0e124ffd12a31569a1ed0d8a6a7b82cf824d63
3 files changed