audio: Remove android.hardware.audio.core.AudioMode type

I missed that there is already android.media.audio.common.AudioMode.
However, due to use by the framework, it contains more values
(all of them are SYS_RESERVED), thus the implementation and VTS
have to be updated as well.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: If260413b1f774a69514de978792d5ad2eb46481a
Merged-In: If260413b1f774a69514de978792d5ad2eb46481a
diff --git a/audio/aidl/default/Telephony.cpp b/audio/aidl/default/Telephony.cpp
index d873178..ad22470 100644
--- a/audio/aidl/default/Telephony.cpp
+++ b/audio/aidl/default/Telephony.cpp
@@ -14,14 +14,18 @@
  * limitations under the License.
  */
 
-#include <android/binder_to_string.h>
 #define LOG_TAG "AHAL_Telephony"
 #include <android-base/logging.h>
 
+#include <Utils.h>
+#include <android/binder_to_string.h>
+
 #include "core-impl/Telephony.h"
 
+using aidl::android::media::audio::common::AudioMode;
 using aidl::android::media::audio::common::Boolean;
 using aidl::android::media::audio::common::Float;
+using android::hardware::audio::common::isValidAudioMode;
 
 namespace aidl::android::hardware::audio::core {
 
@@ -38,6 +42,10 @@
 }
 
 ndk::ScopedAStatus Telephony::switchAudioMode(AudioMode in_mode) {
+    if (!isValidAudioMode(in_mode)) {
+        LOG(ERROR) << __func__ << ": invalid mode " << toString(in_mode);
+        return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+    }
     if (std::find(mSupportedAudioModes.begin(), mSupportedAudioModes.end(), in_mode) !=
         mSupportedAudioModes.end()) {
         LOG(DEBUG) << __func__ << ": " << toString(in_mode);