Android 13.0.0 Release 40 (TQ2A.230405.003.B2)
Ping client Binders without autosuspend lock held

This fixes a deadlock situation:
- system_server is calling acquire/releaseWakeLock on the system suspend
  HAL, but is blocked because mAutosuspendLock is currently held
- The system suspend HAL's autosuspend thread is holding the
  mAutosuspendLock, but blocked in pingBinder(). If system_server's
  Binder thread pool is exhausted and all Binder threads are waiting on
  the acquire/releaseWakeLock call to return.

This change introduces a new lock to protect the list of client tokens.
When checking client liveness by pinging the Binder tokens, the
mAutosuspendLock must not be held, to avoid the circular dependency
described above.

The lock ordering is mAutosuspendClientTokensLock > mAutosuspendLock,
ie. mAutosuspendClientTokensLock must be locked before mAutosuspendLock.

Bug: 241476033
Bug: 237496877
Bug: 241283953
Test: atest SystemSuspendV1_0UnitTest SystemSuspendV1_0AidlTest
Merged-In: Ia480d1f77d632d7c839a1012f5cd7e7555130406
Change-Id: Ia480d1f77d632d7c839a1012f5cd7e7555130406
4 files changed