From d1de935e1dfc8821002f64167cc8d71bd519f527 Mon Sep 17 00:00:00 2001 From: William Escande Date: Tue, 9 May 2023 16:38:23 -0700 Subject: [PATCH] Improve AudioProvider logging Bug: 245009140 Test: looked at some beautiful log when bluetooth is killed (RIP) (cherry picked from https://android-review.googlesource.com/q/commit:fb6dd74b2c84bf6ab0238760e06bcd3d078011c4) Merged-In: If33bee4e875812ce3710d41014cae8bd54d840f2 Change-Id: If33bee4e875812ce3710d41014cae8bd54d840f2 --- .../audio/aidl/default/BluetoothAudioProvider.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp index 727453beca..9c72e195e3 100644 --- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp +++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp @@ -61,6 +61,8 @@ ndk::ScopedAStatus BluetoothAudioProvider::startSession( DataMQDesc* _aidl_return) { if (host_if == nullptr) { *_aidl_return = DataMQDesc(); + LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_) + << " Illegal argument"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } @@ -73,6 +75,7 @@ ndk::ScopedAStatus BluetoothAudioProvider::startSession( AIBinder_linkToDeath(stack_iface_->asBinder().get(), death_recipient_.get(), cookie); + LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); onSessionReady(_aidl_return); return ndk::ScopedAStatus::ok(); } @@ -98,10 +101,9 @@ ndk::ScopedAStatus BluetoothAudioProvider::endSession() { ndk::ScopedAStatus BluetoothAudioProvider::streamStarted( BluetoothAudioStatus status) { - LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) - << ", status=" << toString(status); - if (stack_iface_ != nullptr) { + LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) + << ", status=" << toString(status); BluetoothAudioSessionReport::ReportControlStatus(session_type_, true, status); } else { @@ -129,8 +131,6 @@ ndk::ScopedAStatus BluetoothAudioProvider::streamSuspended( ndk::ScopedAStatus BluetoothAudioProvider::updateAudioConfiguration( const AudioConfiguration& audio_config) { - LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); - if (stack_iface_ == nullptr || audio_config_ == nullptr) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << " has NO session"; @@ -146,13 +146,13 @@ ndk::ScopedAStatus BluetoothAudioProvider::updateAudioConfiguration( audio_config_ = std::make_unique(audio_config); BluetoothAudioSessionReport::ReportAudioConfigChanged(session_type_, *audio_config_); + LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) + << " | audio_config=" << audio_config.toString(); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus BluetoothAudioProvider::setLowLatencyModeAllowed( bool allowed) { - LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); - if (stack_iface_ == nullptr) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << " has NO session";