BtAudio: Fix SessionType mapping
Bug: 203490261
Test: m android.hardware.bluetooth.audio-V1-impl -j
Change-Id: I477e16e4fc060dd145828bca4aba5ad49a56ff76
diff --git a/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp b/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
index 91e0238..93fb735 100644
--- a/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
+++ b/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
@@ -93,16 +93,6 @@
std::unordered_map<uint16_t, std::shared_ptr<PortStatusCallbacks_2_2>>>
legacy_callback_table;
-const static std::unordered_map<SessionType_2_0, SessionType>
- session_type_2_0_to_aidl_map{
- {SessionType_2_0::A2DP_SOFTWARE_ENCODING_DATAPATH,
- SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH},
- {SessionType_2_0::A2DP_HARDWARE_OFFLOAD_DATAPATH,
- SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH},
- {SessionType_2_0::HEARING_AID_SOFTWARE_ENCODING_DATAPATH,
- SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH},
- };
-
const static std::unordered_map<SessionType_2_1, SessionType>
session_type_2_1_to_aidl_map{
{SessionType_2_1::A2DP_SOFTWARE_ENCODING_DATAPATH,
@@ -218,13 +208,6 @@
{LeAudioMode::BROADCAST, LeAudioMode_2_2::BROADCAST},
};
-inline SessionType from_session_type_2_0(
- const SessionType_2_0& session_type_hidl) {
- auto it = session_type_2_0_to_aidl_map.find(session_type_hidl);
- if (it != session_type_2_0_to_aidl_map.end()) return it->second;
- return SessionType::UNKNOWN;
-}
-
inline SessionType from_session_type_2_1(
const SessionType_2_1& session_type_hidl) {
auto it = session_type_2_1_to_aidl_map.find(session_type_hidl);
@@ -232,6 +215,11 @@
return SessionType::UNKNOWN;
}
+inline SessionType from_session_type_2_0(
+ const SessionType_2_0& session_type_hidl) {
+ return from_session_type_2_1(static_cast<SessionType_2_1>(session_type_hidl));
+}
+
inline HidlStatus to_hidl_status(const BluetoothAudioStatus& status) {
switch (status) {
case BluetoothAudioStatus::SUCCESS: