Cache service component name in RoleControllerManager to avoid deadlock.

PackageManagerService needs to know the default home/browser app,
often with the PackageManagerService lock held, so we should avoid
holding the RoleManagerService lock and trying to acquire the
PackageManagerService lock.

Right now the only place we need to access PackageManager while
holding RoleManagerService lock is when creating a
RoleControllerManager, but actually the component name of the remote
service should be the same for any user, so we can just cache the
component name upfront to avoid the deadlock.

Bug: 130130942
Bug: 130303431
Test: manual
Change-Id: Id19edb362a1524663d8d3eb27cef161cf1fa4542
2 files changed