Remove locking inside PermissionRegistry.

This change removes the locking inside PermissionRegistry, and makes
sure that the PermissionManagerService lock is held when calling into
PermissionRegistry.

There are still a small number of cases where a Permission instance
may be retrieved under the lock, but used outside of the locked
block. This may be okay because it doesn't contain any collection
classes that absolutely requires synchronized access, and the worst
theoretical effect is slightly outdated data (if that's even possible
in reality). This has been happening for years in past releases, and
permissions almost never change after being registered.

Bug: 158736025
Test: manual
Change-Id: I8d1c8b64f6db169e8feb23e779db3f326469c5fe
2 files changed