Update ContentProvider counters outside AMS lock
Bug: 157136568 ContentProviderConnection has a set of reference counts that are mostly updated within blocks guarded by the ActivityManagerService (AMS) lock. The exception is refContentProvider(), which is using the AMS lock solely to guard the reference count updates. This change makes ref count updates atomic under control of the local ContentProviderConnection. ContentProviderConnection reference counts are now private and must be modified through accessor methods that enforce coherence. The total reference count is returned. ActivityManagerService methods always operate on the total reference count values that result from the method's increment or decrement operation, as follows: * A count of 1 means the object has just been created and must be initialized. * A count of 0 means the object is no longer used and should be reclaimed. Test: A/B comparisons between baseline and the changed image, with the following atests: * FrameworksServicesTests:UserSystemPackageInstallerTest * PtsChreTestCases * FrameworksServicesTests:UserManagerServiceCreateProfileTest * FrameworksServicesTests:UserManagerServiceIdRecyclingTest * FrameworksServicesTests:UserManagerServiceUserInfoTest * FrameworksServicesTests:UserLifecycleTests * BluetoothInstrumentationTests * CtsCalendarProviderTestCases * CtsContactsProviderTestCases * CtsProviderTestCases The change introduced no failures. Change-Id: I688573ce7aee34d98ec510f432b9eb5cc5929670
Loading
Please register or sign in to comment