AudioRecord: Enforce worker thread join in dtor

Ensure that the AudioRecordThread is joined in dtor. In some
cases if the dtor was called while the worker thread was in
restoreRecord_l() (which had an error due to audioserver restart)
the mStatus check incorrectly prevented join.

Test: atest CtsMediaAudioTestCases
Test: Camera video record and killing audioserver
Test: atest test_callback_race
Bug: 331329042
Merged-In: I2d16e716d8b5945762bc0cfd0b278c5c00ca8f80
Change-Id: I2d16e716d8b5945762bc0cfd0b278c5c00ca8f80
diff --git a/media/libaudioclient/AudioRecord.cpp b/media/libaudioclient/AudioRecord.cpp
index 13018df..7af6eb1 100644
--- a/media/libaudioclient/AudioRecord.cpp
+++ b/media/libaudioclient/AudioRecord.cpp
@@ -189,9 +189,6 @@
 }
 
 void AudioRecord::stopAndJoinCallbacks() {
-    // Prevent nullptr crash if it did not open properly.
-    if (mStatus != NO_ERROR) return;
-
     // Make sure that callback function exits in the case where
     // it is looping on buffer empty condition in obtainBuffer().
     // Otherwise the callback thread will never exit.