Update tee patches in the thread loop.

When secondary output is updated, the tee patches need to
be updated. However, the mixer can access the tee patches
without any lock. In that case, updating tee patches in the
threadloop, which is before mixing, can help avoid race
condition.

Bug: 276314585
Test: manually
Test: atest AudioPlaybackCaptureTest
Change-Id: I36b5ae3777526942a31c7a3122a05477fce0b6df
Merged-In: I36b5ae3777526942a31c7a3122a05477fce0b6df
(cherry picked from commit bad75e935993b51606a5bcbaca051cb64daafc1b)
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index c2c605d..716c358 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3952,7 +3952,7 @@
         patchTrack->setPeerProxy(patchRecord, true /* holdReference */);
         patchRecord->setPeerProxy(patchTrack, false /* holdReference */);
     }
-    track->setTeePatches(std::move(teePatches));
+    track->setTeePatchesToUpdate(std::move(teePatches));
 }
 
 sp<AudioFlinger::SyncEvent> AudioFlinger::createSyncEvent(AudioSystem::sync_event_t type,