More AMS/UGMS lock detangling.
We've seen additional evidence of deadlock between AM and UGMS, so
this change explicitly detangles those two locks to ensure that we
never hold the UGMS lock while calling into AMS, and it adds explicit
validation that will immediately throw instead of waiting a lurking
deadlock to trigger.
This change adds explicit "locked" and "unlocked" tags to relevant
methods inside UGMS to make it easier to track locking dependencies.
It also buttons up internals to be "private", ensuring that all
external callers are routed through our LocalService interface;
this has some additional overhead for inner-class method dispatch,
but the added safety outweighs the cost.
Bug: 115619667, 157863128
Test: atest WmTests:ActivityStarterTests
Test: atest FrameworksServicesTests:com.android.server.uri
Test: atest CtsAppSecurityHostTestCases:android.appsecurity.cts.AppSecurityTests#testPermissionDiffCert
Test: atest CtsWindowManagerDeviceTestCases:CrossAppDragAndDropTests
Test: atest CtsWindowManagerDeviceTestCases:ActivityStarterTests
Change-Id: Ib9d466d6c9844d03626d8f0b30ca69a76d00f02f
2 files changed