Always use audio_configuration_changed_cb_ to notify the config update

There is a new API `isStreamActive` can indicate the stream handle
state. We don't need to use soft_audio_configuration_change_cb to
update the connection map and audio location

Bug: 249614160
Bug: 277857154
Test: LE audio offload disappear and later join with downmix enable
Change-Id: I02357ebe09425525e356ba0f793a3f081953d866
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
index 2b0caad..ee5527e 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
@@ -60,14 +60,12 @@
     LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_)
                << " MqDescriptor Invalid";
     audio_config_ = nullptr;
-    leaudio_connection_map_ = nullptr;
   } else {
     stack_iface_ = stack_iface;
     latency_modes_ = latency_modes;
     LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
               << ", AudioConfiguration=" << audio_config.toString();
     ReportSessionStatus();
-    is_streaming_ = false;
   }
 }
 
@@ -76,13 +74,11 @@
   bool toggled = IsSessionReady();
   LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_);
   audio_config_ = nullptr;
-  leaudio_connection_map_ = nullptr;
   stack_iface_ = nullptr;
   UpdateDataPath(nullptr);
   if (toggled) {
     ReportSessionStatus();
   }
-  is_streaming_ = false;
 }
 
 /***
@@ -110,14 +106,6 @@
   return *audio_config_;
 }
 
-const AudioConfiguration BluetoothAudioSession::GetLeAudioConnectionMap() {
-  std::lock_guard<std::recursive_mutex> guard(mutex_);
-  if (!IsSessionReady()) {
-    return AudioConfiguration(LeAudioConfiguration{});
-  }
-  return *leaudio_connection_map_;
-}
-
 void BluetoothAudioSession::ReportAudioConfigChanged(
     const AudioConfiguration& audio_config) {
   if (session_type_ !=
@@ -134,47 +122,7 @@
     return;
   }
 
-  if (is_streaming_) {
-    if (audio_config_ == nullptr) {
-      LOG(ERROR) << __func__ << " for SessionType=" << toString(session_type_)
-                 << " audio_config_ is nullptr during streaming. It shouldn't "
-                    "be happened";
-      return;
-    }
-
-    auto new_leaudio_config =
-        audio_config.get<AudioConfiguration::leAudioConfig>();
-    auto current_leaudio_config =
-        (*audio_config_).get<AudioConfiguration::leAudioConfig>();
-    if (new_leaudio_config.codecType != current_leaudio_config.codecType) {
-      LOG(ERROR)
-          << __func__ << " for SessionType=" << toString(session_type_)
-          << " codec type changed during streaming. It shouldn't be happened ";
-    }
-    auto new_lc3_config = new_leaudio_config.leAudioCodecConfig
-                              .get<LeAudioCodecConfiguration::lc3Config>();
-    auto current_lc3_config = current_leaudio_config.leAudioCodecConfig
-                                  .get<LeAudioCodecConfiguration::lc3Config>();
-    if ((new_lc3_config.pcmBitDepth != current_lc3_config.pcmBitDepth) ||
-        (new_lc3_config.samplingFrequencyHz !=
-         current_lc3_config.samplingFrequencyHz) ||
-        (new_lc3_config.frameDurationUs !=
-         current_lc3_config.frameDurationUs) ||
-        (new_lc3_config.octetsPerFrame != current_lc3_config.octetsPerFrame) ||
-        (new_lc3_config.blocksPerSdu != current_lc3_config.blocksPerSdu)) {
-      LOG(ERROR)
-          << __func__ << " for SessionType=" << toString(session_type_)
-          << " lc3 config changed during streaming. It shouldn't be happened";
-      return;
-    }
-
-    leaudio_connection_map_ =
-        std::make_unique<AudioConfiguration>(audio_config);
-  } else {
-    audio_config_ = std::make_unique<AudioConfiguration>(audio_config);
-    leaudio_connection_map_ =
-        std::make_unique<AudioConfiguration>(audio_config);
-  }
+  audio_config_ = std::make_unique<AudioConfiguration>(audio_config);
 
   if (observers_.empty()) {
     LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_)
@@ -187,11 +135,7 @@
     LOG(INFO) << __func__ << " for SessionType=" << toString(session_type_)
               << ", bluetooth_audio=0x"
               << ::android::base::StringPrintf("%04x", cookie);
-    if (is_streaming_) {
-      if (cb->soft_audio_configuration_changed_cb_ != nullptr) {
-        cb->soft_audio_configuration_changed_cb_(cookie);
-      }
-    } else if (cb->audio_configuration_changed_cb_ != nullptr) {
+    if (cb->audio_configuration_changed_cb_ != nullptr) {
       cb->audio_configuration_changed_cb_(cookie);
     }
   }
@@ -481,12 +425,6 @@
                  << " has NO port state observer";
     return;
   }
-  if (start_resp && status == BluetoothAudioStatus::SUCCESS) {
-    is_streaming_ = true;
-  } else if (!start_resp && (status == BluetoothAudioStatus::SUCCESS ||
-                             status == BluetoothAudioStatus::RECONFIGURATION)) {
-    is_streaming_ = false;
-  }
   for (auto& observer : observers_) {
     uint16_t cookie = observer.first;
     std::shared_ptr<PortStatusCallbacks> callback = observer.second;