LeAudio: Improve function naming

This change improves some of the function naming
so that it was more obvious what each of them do
at the point where they are called, without looking
into the implementation. This improves code readability.
It also for consisency replaces a static DebugDump
function call that was called on an instance, while
all other calls around are called directly from the
class namespace.

Bug: 256967923
Test: atest --host bluetooth_le_audio_test bluetooth_le_audio_client_test --no-bazel-mode
Change-Id: Id51c18211ee3936b8890dc21c0ed139969b51810
diff --git a/system/bta/le_audio/client.cc b/system/bta/le_audio/client.cc
index 85dba6f..509c317 100644
--- a/system/bta/le_audio/client.cc
+++ b/system/bta/le_audio/client.cc
@@ -2513,8 +2513,9 @@
     cached_channel_is_left_ = false;
   }
 
-  void SendAudioData(uint8_t* data, uint16_t size, uint16_t cis_conn_hdl,
-                     uint32_t timestamp) {
+  /* Handles audio data packets coming from the controller */
+  void HandleIncomingCisData(uint8_t* data, uint16_t size,
+                             uint16_t cis_conn_hdl, uint32_t timestamp) {
     /* Get only one channel for MONO microphone */
     /* Gather data for channel */
     if ((active_group_id_ == bluetooth::groups::kGroupUnknown) ||
@@ -3063,9 +3064,9 @@
   }
 
   void OnLocalAudioSourceSuspend() {
-    LOG_DEBUG(" IN: audio_receiver_state_: %s,  audio_sender_state_: %s",
-              ToString(audio_receiver_state_).c_str(),
-              ToString(audio_sender_state_).c_str());
+    LOG_INFO("IN: audio_receiver_state_: %s,  audio_sender_state_: %s",
+             ToString(audio_receiver_state_).c_str(),
+             ToString(audio_sender_state_).c_str());
 
     /* Note: This callback is from audio hal driver.
      * Bluetooth peer is a Sink for Audio Framework.
@@ -3094,14 +3095,15 @@
       le_audio::MetricsCollector::Get()->OnStreamEnded(active_group_id_);
     }
 
-    DLOG(INFO) << __func__
-               << " OUT: audio_receiver_state_: " << audio_receiver_state_
-               << " audio_sender_state_: " << audio_sender_state_;
+    LOG_INFO("OUT: audio_receiver_state_: %s,  audio_sender_state_: %s",
+             ToString(audio_receiver_state_).c_str(),
+             ToString(audio_sender_state_).c_str());
   }
 
   void OnLocalAudioSourceResume() {
-    LOG(INFO) << __func__;
-
+    LOG_INFO("IN: audio_receiver_state_: %s,  audio_sender_state_: %s",
+             ToString(audio_receiver_state_).c_str(),
+             ToString(audio_sender_state_).c_str());
     /* Note: This callback is from audio hal driver.
      * Bluetooth peer is a Sink for Audio Framework.
      * e.g. Peer is a speaker
@@ -3207,9 +3209,9 @@
   }
 
   void OnLocalAudioSinkSuspend() {
-    LOG_DEBUG(" IN: audio_receiver_state_: %s,  audio_sender_state_: %s",
-              ToString(audio_receiver_state_).c_str(),
-              ToString(audio_sender_state_).c_str());
+    LOG_INFO("IN: audio_receiver_state_: %s,  audio_sender_state_: %s",
+             ToString(audio_receiver_state_).c_str(),
+             ToString(audio_sender_state_).c_str());
 
     /* Note: This callback is from audio hal driver.
      * Bluetooth peer is a Source for Audio Framework.
@@ -3236,9 +3238,9 @@
         (audio_sender_state_ == AudioState::READY_TO_RELEASE))
       OnAudioSuspend();
 
-    DLOG(INFO) << __func__
-               << " OUT: audio_receiver_state_: " << audio_receiver_state_
-               << " audio_sender_state_: " << audio_sender_state_;
+    LOG_INFO("OUT: audio_receiver_state_: %s,  audio_sender_state_: %s",
+             ToString(audio_receiver_state_).c_str(),
+             ToString(audio_sender_state_).c_str());
   }
 
   bool IsAudioSourceAvailableForCurrentConfiguration() {
@@ -3251,7 +3253,9 @@
   }
 
   void OnLocalAudioSinkResume() {
-    LOG(INFO) << __func__;
+    LOG_INFO("IN: audio_receiver_state_: %s,  audio_sender_state_: %s",
+             ToString(audio_receiver_state_).c_str(),
+             ToString(audio_sender_state_).c_str());
 
     /* Note: This callback is from audio hal driver.
      * Bluetooth peer is a Source for Audio Framework.
@@ -3401,8 +3405,9 @@
     auto reconfig_result = UpdateConfigAndCheckIfReconfigurationIsNeeded(
         group->group_id_, new_context_type);
 
-    LOG_INFO("group_id %d, context type %s, reconfig_needed %s",
-             group->group_id_, ToHexString(new_context_type).c_str(),
+    LOG_INFO("group_id %d, context type %s (%s), %s", group->group_id_,
+             ToString(new_context_type).c_str(),
+             ToHexString(new_context_type).c_str(),
              ToString(reconfig_result).c_str());
     if (reconfig_result ==
         AudioReconfigurationResult::RECONFIGURATION_NOT_NEEDED) {
@@ -3642,9 +3647,9 @@
           break;
         }
 
-        SendAudioData(event->p_msg->data + event->p_msg->offset,
-                      event->p_msg->len - event->p_msg->offset,
-                      event->cis_conn_hdl, event->ts);
+        HandleIncomingCisData(event->p_msg->data + event->p_msg->offset,
+                              event->p_msg->len - event->p_msg->offset,
+                              event->cis_conn_hdl, event->ts);
       } break;
       case bluetooth::hci::iso_manager::kIsoEventCisEstablishCmpl: {
         auto* event =
@@ -3849,7 +3854,7 @@
     stream_setup_start_timestamp_ = 0;
   }
 
-  void StatusReportCb(int group_id, GroupStreamStatus status) {
+  void OnStateMachineStatusReportCb(int group_id, GroupStreamStatus status) {
     LOG_INFO("status: %d , audio_sender_state %s, audio_receiver_state %s",
              static_cast<int>(status),
              bluetooth::common::ToString(audio_sender_state_).c_str(),
@@ -4132,7 +4137,7 @@
 class CallbacksImpl : public LeAudioGroupStateMachine::Callbacks {
  public:
   void StatusReportCb(int group_id, GroupStreamStatus status) override {
-    if (instance) instance->StatusReportCb(group_id, status);
+    if (instance) instance->OnStateMachineStatusReportCb(group_id, status);
   }
 
   void OnStateTransitionTimeout(int group_id) override {
@@ -4158,7 +4163,8 @@
 
   void OnAudioMetadataUpdate(
       std::vector<struct playback_track_metadata> source_metadata) override {
-    if (instance) instance->OnLocalAudioSourceMetadataUpdate(source_metadata);
+    if (instance)
+      instance->OnLocalAudioSourceMetadataUpdate(std::move(source_metadata));
   }
 };
 
@@ -4174,7 +4180,8 @@
 
   void OnAudioMetadataUpdate(
       std::vector<struct record_track_metadata> sink_metadata) override {
-    if (instance) instance->OnLocalAudioSinkMetadataUpdate(sink_metadata);
+    if (instance)
+      instance->OnLocalAudioSinkMetadataUpdate(std::move(sink_metadata));
   }
 };
 
@@ -4323,7 +4330,7 @@
 
   LeAudioSinkAudioHalClient::DebugDump(fd);
   LeAudioSourceAudioHalClient::DebugDump(fd);
-  le_audio::AudioSetConfigurationProvider::Get()->DebugDump(fd);
+  le_audio::AudioSetConfigurationProvider::DebugDump(fd);
   IsoManager::GetInstance()->Dump(fd);
   dprintf(fd, "\n");
 }
diff --git a/system/bta/le_audio/devices.cc b/system/bta/le_audio/devices.cc
index 8a3f760..4403d38 100644
--- a/system/bta/le_audio/devices.cc
+++ b/system/bta/le_audio/devices.cc
@@ -856,7 +856,7 @@
   return target_state_ != current_state_;
 }
 
-bool LeAudioDeviceGroup::IsReleasing(void) {
+bool LeAudioDeviceGroup::IsReleasingOrIdle(void) {
   return target_state_ == AseState::BTA_LE_AUDIO_ASE_STATE_IDLE;
 }
 
diff --git a/system/bta/le_audio/devices.h b/system/bta/le_audio/devices.h
index e5edd79..2460412 100644
--- a/system/bta/le_audio/devices.h
+++ b/system/bta/le_audio/devices.h
@@ -362,7 +362,7 @@
   }
 
   bool IsInTransition(void);
-  bool IsReleasing(void);
+  bool IsReleasingOrIdle(void);
   void Dump(int fd, int active_group_id);
 
  private:
diff --git a/system/bta/le_audio/state_machine.cc b/system/bta/le_audio/state_machine.cc
index de23c80..00ef80a 100644
--- a/system/bta/le_audio/state_machine.cc
+++ b/system/bta/le_audio/state_machine.cc
@@ -278,7 +278,7 @@
   }
 
   void StopStream(LeAudioDeviceGroup* group) override {
-    if (group->IsReleasing()) {
+    if (group->IsReleasingOrIdle()) {
       LOG(INFO) << __func__ << ", group: " << group->group_id_
                 << " already in releasing process";
       return;