AudioFlinger: add mutex order to constructor
Used for mutex debug tracking.
Test: validated through dynamic mutex order checking on CTS tests
Bug: 306277363
Bug: 307629326
Change-Id: I0df5218b2c6426479bb16688b42f1cc16ff46028
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 6af8015..68878e8 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -423,7 +423,8 @@
// for as long as possible. The memory is only freed when it is needed for another log writer.
Vector< sp<NBLog::Writer> > mUnregisteredWriters;
audio_utils::mutex& unregisteredWritersMutex() const { return mUnregisteredWritersMutex; }
- mutable audio_utils::mutex mUnregisteredWritersMutex;
+ mutable audio_utils::mutex mUnregisteredWritersMutex{
+ audio_utils::MutexOrder::kAudioFlinger_UnregisteredWritersMutex};
AudioFlinger() ANDROID_API;
~AudioFlinger() override;
@@ -495,7 +496,7 @@
bool mPendingRequests;
// Mutex and condition variable around mPendingRequests' value
- audio_utils::mutex mMutex;
+ audio_utils::mutex mMutex{audio_utils::MutexOrder::kMediaLogNotifier_Mutex};
audio_utils::condition_variable mCondition;
// Duration of the sleep period after a processed request
@@ -604,18 +605,19 @@
int mCnt;
};
- mutable audio_utils::mutex mMutex;
+ mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kAudioFlinger_Mutex};
// protects mClients and mNotificationClients.
// must be locked after mutex() and ThreadBase::mutex() if both must be locked
// avoids acquiring AudioFlinger::mutex() from inside thread loop.
- mutable audio_utils::mutex mClientMutex;
+ mutable audio_utils::mutex mClientMutex{audio_utils::MutexOrder::kAudioFlinger_ClientMutex};
DefaultKeyedVector<pid_t, wp<Client>> mClients GUARDED_BY(clientMutex()); // see ~Client()
audio_utils::mutex& hardwareMutex() const { return mHardwareMutex; }
- mutable audio_utils::mutex mHardwareMutex;
+ mutable audio_utils::mutex mHardwareMutex{
+ audio_utils::MutexOrder::kAudioFlinger_HardwareMutex};
// NOTE: If both mMutex and mHardwareMutex mutexes must be held,
// always take mMutex before mHardwareMutex