AudioFlinger: update primaryPlaybackThread_l() getter

Due to mutex reordering (Hardware mutex moved after effect mutexes),
hw mutex may not be held when acquiring thread mutex.

Bug: 329395147
Test: manual
Flag: EXEMPT bugfix
Change-Id: I1d03d5fa4fe870d9f0bc5ffcc4a2723c709af09d
Signed-off-by: François Gaffie <francois.gaffie@ampere.cars>
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 60be37d..a17ac58 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3812,7 +3812,11 @@
 
 IAfPlaybackThread* AudioFlinger::primaryPlaybackThread_l() const
 {
-    audio_utils::lock_guard lock(hardwareMutex());
+    // The atomic ptr mPrimaryHardwareDev requires both the
+    // AudioFlinger and the Hardware mutex for modification.
+    // As we hold the AudioFlinger mutex, we access it
+    // safely without the Hardware mutex, to avoid mutex order
+    // inversion with Thread methods and the ThreadBase mutex.
     if (mPrimaryHardwareDev == nullptr) {
         return nullptr;
     }