Refactor PropertyInvalidatedCache locks

Bug: 241763149

Refactor the sCorkLock into sCorkLock, which protects code that
specifically supports corking, and sGlobalLock, which protects all
other code that touches global objects (like the list of all caches).

Deadlock was not actually observed in the bug and has never been
reported, but the possibility was identified and is being fixed here.

Bypass the bulk of disableLocal(name) if the name has already been
bypassed.  This speeds repeated calls to disableLocal() by not
iterating over sCaches.

Many threads were terminated by a watchdog while iterating over
sCaches inside disableLocal().  It is not known why this block of code
was running so often when the time out expired.

An open question is whether or not disabled caches should be removed
from the sCaches array.  The only reason to leave them in the array is
to report on them during dumpsys, but this seems like a small benefit

Test: atest
 * FrameworksCoreTests:IpcDataCacheTest
 * FrameworksCoreTests:PropertyInvalidatedCacheTests
 * CtsOsTestCases:IpcDataCacheTest
Change-Id: I4c298f380044c0be93cdb47d66d7d7e2b260004f
1 file changed