Clean up VtsHalRadioTargetTest

Refactor class design so RadioServiceTest extends TestWithParam and
each individual radio service test extends RadioServiceTest.
Move setup and teardown logic common to all classes to RadioServiceTest.
Add logs to print when each test starts/finishes to help debug issues.
Remove unused imports and fix some typos.
Change unique_lock to lock_guard in notify to prevent MTE errors.

Test: atest VtsHalRadioTargetTest on fullmte build
Bug: 263940636
Change-Id: I2f6844f07d4518c00d47f98e5e15bea0a809fa84
diff --git a/radio/aidl/vts/radio_voice_test.cpp b/radio/aidl/vts/radio_voice_test.cpp
index 249ee63..397c417 100644
--- a/radio/aidl/vts/radio_voice_test.cpp
+++ b/radio/aidl/vts/radio_voice_test.cpp
@@ -16,7 +16,6 @@
 
 #include <aidl/android/hardware/radio/config/IRadioConfig.h>
 #include <aidl/android/hardware/radio/voice/EmergencyServiceCategory.h>
-#include <android-base/logging.h>
 #include <android/binder_manager.h>
 
 #include "radio_voice_utils.h"
@@ -24,6 +23,7 @@
 #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
 
 void RadioVoiceTest::SetUp() {
+    RadioServiceTest::SetUp();
     std::string serviceName = GetParam();
 
     if (!isServiceValidForDeviceConfiguration(serviceName)) {
@@ -38,8 +38,6 @@
     radioRsp_voice = ndk::SharedRefBase::make<RadioVoiceResponse>(*this);
     ASSERT_NE(nullptr, radioRsp_voice.get());
 
-    count_ = 0;
-
     radioInd_voice = ndk::SharedRefBase::make<RadioVoiceIndication>(*this);
     ASSERT_NE(nullptr, radioInd_voice.get());
 
@@ -324,7 +322,6 @@
  * Test IRadioVoice.getTtyMode() for the response returned.
  */
 TEST_P(RadioVoiceTest, getTtyMode) {
-    LOG(DEBUG) << "getTtyMode";
     serial = GetRandomSerialNumber();
 
     radio_voice->getTtyMode(serial);
@@ -335,14 +332,12 @@
     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
         EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
     }
-    LOG(DEBUG) << "getTtyMode finished";
 }
 
 /*
  * Test IRadioVoice.setTtyMode() for the response returned.
  */
 TEST_P(RadioVoiceTest, setTtyMode) {
-    LOG(DEBUG) << "setTtyMode";
     serial = GetRandomSerialNumber();
 
     radio_voice->setTtyMode(serial, TtyMode::OFF);
@@ -353,14 +348,12 @@
     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
         EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
     }
-    LOG(DEBUG) << "setTtyMode finished";
 }
 
 /*
  * Test IRadioVoice.setPreferredVoicePrivacy() for the response returned.
  */
 TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) {
-    LOG(DEBUG) << "setPreferredVoicePrivacy";
     serial = GetRandomSerialNumber();
 
     radio_voice->setPreferredVoicePrivacy(serial, true);
@@ -372,14 +365,12 @@
         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
     }
-    LOG(DEBUG) << "setPreferredVoicePrivacy finished";
 }
 
 /*
  * Test IRadioVoice.getPreferredVoicePrivacy() for the response returned.
  */
 TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) {
-    LOG(DEBUG) << "getPreferredVoicePrivacy";
     serial = GetRandomSerialNumber();
 
     radio_voice->getPreferredVoicePrivacy(serial);
@@ -391,14 +382,12 @@
         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
     }
-    LOG(DEBUG) << "getPreferredVoicePrivacy finished";
 }
 
 /*
  * Test IRadioVoice.exitEmergencyCallbackMode() for the response returned.
  */
 TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) {
-    LOG(DEBUG) << "exitEmergencyCallbackMode";
     serial = GetRandomSerialNumber();
 
     radio_voice->exitEmergencyCallbackMode(serial);
@@ -411,14 +400,12 @@
                 radioRsp_voice->rspInfo.error,
                 {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
     }
-    LOG(DEBUG) << "exitEmergencyCallbackMode finished";
 }
 
 /*
  * Test IRadioVoice.handleStkCallSetupRequestFromSim() for the response returned.
  */
 TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) {
-    LOG(DEBUG) << "handleStkCallSetupRequestFromSim";
     serial = GetRandomSerialNumber();
     bool accept = false;
 
@@ -434,14 +421,12 @@
                                       RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "handleStkCallSetupRequestFromSim finished";
 }
 
 /*
  * Test IRadioVoice.dial() for the response returned.
  */
 TEST_P(RadioVoiceTest, dial) {
-    LOG(DEBUG) << "dial";
     serial = GetRandomSerialNumber();
 
     Dial dialInfo;
@@ -463,14 +448,12 @@
                  RadioError::OPERATION_NOT_ALLOWED},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "dial finished";
 }
 
 /*
  * Test IRadioVoice.hangup() for the response returned.
  */
 TEST_P(RadioVoiceTest, hangup) {
-    LOG(DEBUG) << "hangup";
     serial = GetRandomSerialNumber();
 
     radio_voice->hangup(serial, 1);
@@ -484,14 +467,12 @@
                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "hangup finished";
 }
 
 /*
  * Test IRadioVoice.hangupWaitingOrBackground() for the response returned.
  */
 TEST_P(RadioVoiceTest, hangupWaitingOrBackground) {
-    LOG(DEBUG) << "hangupWaitingOrBackground";
     serial = GetRandomSerialNumber();
 
     radio_voice->hangupWaitingOrBackground(serial);
@@ -504,14 +485,12 @@
                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "hangupWaitingOrBackground finished";
 }
 
 /*
  * Test IRadioVoice.hangupForegroundResumeBackground() for the response returned.
  */
 TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) {
-    LOG(DEBUG) << "hangupForegroundResumeBackground";
     serial = GetRandomSerialNumber();
 
     radio_voice->hangupForegroundResumeBackground(serial);
@@ -524,14 +503,12 @@
                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "hangupForegroundResumeBackground finished";
 }
 
 /*
  * Test IRadioVoice.switchWaitingOrHoldingAndActive() for the response returned.
  */
 TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) {
-    LOG(DEBUG) << "switchWaitingOrHoldingAndActive";
     serial = GetRandomSerialNumber();
 
     radio_voice->switchWaitingOrHoldingAndActive(serial);
@@ -544,14 +521,12 @@
                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "switchWaitingOrHoldingAndActive finished";
 }
 
 /*
  * Test IRadioVoice.conference() for the response returned.
  */
 TEST_P(RadioVoiceTest, conference) {
-    LOG(DEBUG) << "conference";
     serial = GetRandomSerialNumber();
 
     radio_voice->conference(serial);
@@ -564,14 +539,12 @@
                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "conference finished";
 }
 
 /*
  * Test IRadioVoice.rejectCall() for the response returned.
  */
 TEST_P(RadioVoiceTest, rejectCall) {
-    LOG(DEBUG) << "rejectCall";
     serial = GetRandomSerialNumber();
 
     radio_voice->rejectCall(serial);
@@ -584,14 +557,12 @@
                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "rejectCall finished";
 }
 
 /*
  * Test IRadioVoice.getLastCallFailCause() for the response returned.
  */
 TEST_P(RadioVoiceTest, getLastCallFailCause) {
-    LOG(DEBUG) << "getLastCallFailCause";
     serial = GetRandomSerialNumber();
 
     radio_voice->getLastCallFailCause(serial);
@@ -603,14 +574,12 @@
         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::NONE},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "getLastCallFailCause finished";
 }
 
 /*
  * Test IRadioVoice.getCallForwardStatus() for the response returned.
  */
 TEST_P(RadioVoiceTest, getCallForwardStatus) {
-    LOG(DEBUG) << "getCallForwardStatus";
     serial = GetRandomSerialNumber();
     CallForwardInfo callInfo;
     memset(&callInfo, 0, sizeof(callInfo));
@@ -627,14 +596,12 @@
                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "getCallForwardStatus finished";
 }
 
 /*
  * Test IRadioVoice.setCallForward() for the response returned.
  */
 TEST_P(RadioVoiceTest, setCallForward) {
-    LOG(DEBUG) << "setCallForward";
     serial = GetRandomSerialNumber();
     CallForwardInfo callInfo;
     memset(&callInfo, 0, sizeof(callInfo));
@@ -651,14 +618,12 @@
                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "setCallForward finished";
 }
 
 /*
  * Test IRadioVoice.getCallWaiting() for the response returned.
  */
 TEST_P(RadioVoiceTest, getCallWaiting) {
-    LOG(DEBUG) << "getCallWaiting";
     serial = GetRandomSerialNumber();
 
     radio_voice->getCallWaiting(serial, 1);
@@ -672,14 +637,12 @@
                 {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "getCallWaiting finished";
 }
 
 /*
  * Test IRadioVoice.setCallWaiting() for the response returned.
  */
 TEST_P(RadioVoiceTest, setCallWaiting) {
-    LOG(DEBUG) << "setCallWaiting";
     serial = GetRandomSerialNumber();
 
     radio_voice->setCallWaiting(serial, true, 1);
@@ -693,14 +656,12 @@
                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "setCallWaiting finished";
 }
 
 /*
  * Test IRadioVoice.acceptCall() for the response returned.
  */
 TEST_P(RadioVoiceTest, acceptCall) {
-    LOG(DEBUG) << "acceptCall";
     serial = GetRandomSerialNumber();
 
     radio_voice->acceptCall(serial);
@@ -713,14 +674,12 @@
                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "acceptCall finished";
 }
 
 /*
  * Test IRadioVoice.separateConnection() for the response returned.
  */
 TEST_P(RadioVoiceTest, separateConnection) {
-    LOG(DEBUG) << "separateConnection";
     serial = GetRandomSerialNumber();
 
     radio_voice->separateConnection(serial, 1);
@@ -734,14 +693,12 @@
                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "separateConnection finished";
 }
 
 /*
  * Test IRadioVoice.explicitCallTransfer() for the response returned.
  */
 TEST_P(RadioVoiceTest, explicitCallTransfer) {
-    LOG(DEBUG) << "explicitCallTransfer";
     serial = GetRandomSerialNumber();
 
     radio_voice->explicitCallTransfer(serial);
@@ -754,14 +711,12 @@
                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "explicitCallTransfer finished";
 }
 
 /*
  * Test IRadioVoice.sendCdmaFeatureCode() for the response returned.
  */
 TEST_P(RadioVoiceTest, sendCdmaFeatureCode) {
-    LOG(DEBUG) << "sendCdmaFeatureCode";
     serial = GetRandomSerialNumber();
 
     radio_voice->sendCdmaFeatureCode(serial, std::string());
@@ -776,14 +731,12 @@
                                       RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "sendCdmaFeatureCode finished";
 }
 
 /*
  * Test IRadioVoice.sendDtmf() for the response returned.
  */
 TEST_P(RadioVoiceTest, sendDtmf) {
-    LOG(DEBUG) << "sendDtmf";
     serial = GetRandomSerialNumber();
 
     radio_voice->sendDtmf(serial, "1");
@@ -798,14 +751,12 @@
                  RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "sendDtmf finished";
 }
 
 /*
  * Test IRadioVoice.startDtmf() for the response returned.
  */
 TEST_P(RadioVoiceTest, startDtmf) {
-    LOG(DEBUG) << "startDtmf";
     serial = GetRandomSerialNumber();
 
     radio_voice->startDtmf(serial, "1");
@@ -820,14 +771,12 @@
                  RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "startDtmf finished";
 }
 
 /*
  * Test IRadioVoice.stopDtmf() for the response returned.
  */
 TEST_P(RadioVoiceTest, stopDtmf) {
-    LOG(DEBUG) << "stopDtmf";
     serial = GetRandomSerialNumber();
 
     radio_voice->stopDtmf(serial);
@@ -841,14 +790,12 @@
                                       RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "stopDtmf finished";
 }
 
 /*
  * Test IRadioVoice.setMute() for the response returned.
  */
 TEST_P(RadioVoiceTest, setMute) {
-    LOG(DEBUG) << "setMute";
     serial = GetRandomSerialNumber();
 
     radio_voice->setMute(serial, true);
@@ -861,14 +808,12 @@
                                      {RadioError::NONE, RadioError::INVALID_ARGUMENTS},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "setMute finished";
 }
 
 /*
  * Test IRadioVoice.getMute() for the response returned.
  */
 TEST_P(RadioVoiceTest, getMute) {
-    LOG(DEBUG) << "getMute";
     serial = GetRandomSerialNumber();
 
     radio_voice->getMute(serial);
@@ -879,14 +824,12 @@
     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
         EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
     }
-    LOG(DEBUG) << "getMute finished";
 }
 
 /*
  * Test IRadioVoice.sendBurstDtmf() for the response returned.
  */
 TEST_P(RadioVoiceTest, sendBurstDtmf) {
-    LOG(DEBUG) << "sendBurstDtmf";
     serial = GetRandomSerialNumber();
 
     radio_voice->sendBurstDtmf(serial, "1", 0, 0);
@@ -900,14 +843,12 @@
                                       RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
                                      CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "sendBurstDtmf finished";
 }
 
 /*
  * Test IRadioVoice.sendUssd() for the response returned.
  */
 TEST_P(RadioVoiceTest, sendUssd) {
-    LOG(DEBUG) << "sendUssd";
     serial = GetRandomSerialNumber();
     radio_voice->sendUssd(serial, std::string("test"));
     EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -920,14 +861,12 @@
                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "sendUssd finished";
 }
 
 /*
  * Test IRadioVoice.cancelPendingUssd() for the response returned.
  */
 TEST_P(RadioVoiceTest, cancelPendingUssd) {
-    LOG(DEBUG) << "cancelPendingUssd";
     serial = GetRandomSerialNumber();
 
     radio_voice->cancelPendingUssd(serial);
@@ -941,14 +880,12 @@
                 {RadioError::NONE, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
                 CHECK_GENERAL_ERROR));
     }
-    LOG(DEBUG) << "cancelPendingUssd finished";
 }
 
 /*
  * Test IRadioVoice.isVoNrEnabled() for the response returned.
  */
 TEST_P(RadioVoiceTest, isVoNrEnabled) {
-    LOG(DEBUG) << "isVoNrEnabled";
     serial = GetRandomSerialNumber();
 
     radio_voice->isVoNrEnabled(serial);
@@ -958,14 +895,12 @@
 
     ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
                                  {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
-    LOG(DEBUG) << "isVoNrEnabled finished";
 }
 
 /*
  * Test IRadioVoice.setVoNrEnabled() for the response returned.
  */
 TEST_P(RadioVoiceTest, setVoNrEnabled) {
-    LOG(DEBUG) << "setVoNrEnabled";
     serial = GetRandomSerialNumber();
 
     radio_voice->setVoNrEnabled(serial, true);
@@ -975,5 +910,4 @@
 
     ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
                                  {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
-    LOG(DEBUG) << "setVoNrEnabled finished";
 }