Loading system/btif/avrcp/avrcp_service.cc +17 −23 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <base/logging.h> #include <base/task/cancelable_task_tracker.h> #include <base/threading/thread.h> #include <bluetooth/log.h> #include <mutex> #include <sstream> Loading Loading @@ -374,7 +375,7 @@ class PlayerSettingsInterfaceWrapper : public PlayerSettingsInterface { void AvrcpService::Init(MediaInterface* media_interface, VolumeInterface* volume_interface, PlayerSettingsInterface* player_settings_interface) { LOG(INFO) << "AVRCP Target Service started"; log::info("AVRCP Target Service started"); profile_version = avrcp_interface_.GetAvrcpVersion(); Loading Loading @@ -435,7 +436,7 @@ uint16_t AvrcpService::GetSupportedFeatures(uint16_t profile_version) { } void AvrcpService::Cleanup() { LOG(INFO) << "AVRCP Target Service stopped"; log::info("AVRCP Target Service stopped"); avrcp_interface_.RemoveRecord(sdp_record_handle); bta_sys_remove_uuid(UUID_SERVCLASS_AV_REM_CTRL_TARGET); Loading @@ -456,8 +457,8 @@ void AvrcpService::Cleanup() { } void AvrcpService::RegisterBipServer(int psm) { LOG(INFO) << "AVRCP Target Service has registered a BIP OBEX server, psm=" << psm; log::info("AVRCP Target Service has registered a BIP OBEX server, psm={}", psm); avrcp_interface_.RemoveRecord(sdp_record_handle); uint16_t supported_features = GetSupportedFeatures(profile_version) | AVRC_SUPF_TG_PLAYER_COVER_ART; Loading @@ -469,7 +470,7 @@ void AvrcpService::RegisterBipServer(int psm) { } void AvrcpService::UnregisterBipServer() { LOG(INFO) << "AVRCP Target Service has unregistered a BIP OBEX server"; log::info("AVRCP Target Service has unregistered a BIP OBEX server"); avrcp_interface_.RemoveRecord(sdp_record_handle); uint16_t supported_features = GetSupportedFeatures(profile_version); sdp_record_handle = get_legacy_stack_sdp_api()->handle.SDP_CreateRecord(); Loading @@ -493,32 +494,27 @@ ServiceInterface* AvrcpService::GetServiceInterface() { } void AvrcpService::ConnectDevice(const RawAddress& bdaddr) { LOG(INFO) << __PRETTY_FUNCTION__ << ": address=" << ADDRESS_TO_LOGGABLE_STR(bdaddr); log::info("address={}", ADDRESS_TO_LOGGABLE_STR(bdaddr)); connection_handler_->ConnectDevice(bdaddr); } void AvrcpService::DisconnectDevice(const RawAddress& bdaddr) { LOG(INFO) << __PRETTY_FUNCTION__ << ": address=" << ADDRESS_TO_LOGGABLE_STR(bdaddr); log::info("address={}", ADDRESS_TO_LOGGABLE_STR(bdaddr)); connection_handler_->DisconnectDevice(bdaddr); } void AvrcpService::SetBipClientStatus(const RawAddress& bdaddr, bool connected) { LOG(INFO) << __PRETTY_FUNCTION__ << ": address=" << ADDRESS_TO_LOGGABLE_STR(bdaddr) << ", connected=" << connected; log::info("address={}, connected={}", ADDRESS_TO_LOGGABLE_STR(bdaddr), connected); connection_handler_->SetBipClientStatus(bdaddr, connected); } void AvrcpService::SendMediaUpdate(bool track_changed, bool play_state, bool queue) { LOG(INFO) << __PRETTY_FUNCTION__ << " track_changed=" << track_changed << " : " << " play_state=" << play_state << " : " << " queue=" << queue; log::info("track_changed={} : play_state={} : queue={}", track_changed, play_state, queue); // This function may be called on any thread, we need to make sure that the // device update happens on the main thread. Loading @@ -532,10 +528,8 @@ void AvrcpService::SendMediaUpdate(bool track_changed, bool play_state, void AvrcpService::SendFolderUpdate(bool available_players, bool addressed_players, bool uids) { LOG(INFO) << __PRETTY_FUNCTION__ << " available_players=" << available_players << " : " << " addressed_players=" << addressed_players << " : " << " uids=" << uids; log::info("available_players={} : addressed_players={} : uids={}", available_players, addressed_players, uids); // Ensure that the update is posted to the correct thread for (const auto& device : Loading @@ -554,7 +548,7 @@ void AvrcpService::SendActiveDeviceChanged(const RawAddress& address) { void AvrcpService::SendPlayerSettingsChanged( std::vector<PlayerAttribute> attributes, std::vector<uint8_t> values) { LOG(INFO) << __PRETTY_FUNCTION__; log::info(""); std::stringstream ss; for (size_t i = 0; i < attributes.size(); i++) { ss << "attribute=" << attributes.at(i) << " : "; Loading @@ -568,7 +562,7 @@ void AvrcpService::SendPlayerSettingsChanged( ss << std::endl; } LOG(INFO) << ss.str(); log::info("{}", ss.str()); // Ensure that the update is posted to the correct thread for (const auto& device : Loading Loading @@ -694,7 +688,7 @@ void AvrcpService::DebugDump(int fd) { /** when a2dp connected, btif will start register vol changed, so we need a * interface for it. */ void AvrcpService::RegisterVolChanged(const RawAddress& bdaddr) { LOG(INFO) << ": address=" << ADDRESS_TO_LOGGABLE_STR(bdaddr); log::info(": address={}", ADDRESS_TO_LOGGABLE_STR(bdaddr)); connection_handler_->RegisterVolChanged(bdaddr); } Loading system/btif/include/btif_common.h +14 −14 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <base/functional/bind.h> #include <base/location.h> #include <bluetooth/log.h> #include <hardware/bluetooth.h> #include <stdlib.h> Loading @@ -41,8 +42,7 @@ #define ASSERTC(cond, msg, val) \ do { \ if (!(cond)) { \ LOG_ERROR("### ASSERT : %s %s line %d %s (%d) ###", __FILE__, __func__, \ __LINE__, (msg), (val)); \ bluetooth::log::error("### ASSERT : {} ({}) ###", (msg), (val)); \ } \ } while (0) Loading @@ -66,7 +66,7 @@ #define HAL_CBACK(P_CB, P_CBACK, ...) \ do { \ if ((P_CB) && (P_CB)->P_CBACK) { \ LOG_VERBOSE("%s: HAL %s->%s", __func__, #P_CB, #P_CBACK); \ bluetooth::log::verbose("HAL {}->{}", #P_CB, #P_CBACK); \ (P_CB)->P_CBACK(__VA_ARGS__); \ } else { \ ASSERTC(0, "Callback is NULL", 0); \ Loading system/btif/test/btif_rc_test.cc +3 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #undef LOG_TAG // Undefine the LOG_TAG by this compilation unit #include "btif/src/btif_rc.cc" #include <bluetooth/log.h> #include <gtest/gtest.h> #include <cstdint> Loading Loading @@ -107,7 +108,7 @@ static bluetooth::common::MessageLoopThread jni_thread("bt_jni_thread"); bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { if (!jni_thread.DoInThread(from_here, std::move(task))) { LOG(ERROR) << __func__ << ": Post task to task runner failed!"; log::error("Post task to task runner failed!"); return BT_STATUS_FAIL; } return BT_STATUS_SUCCESS; Loading Loading @@ -264,7 +265,7 @@ TEST_F(BtifRcWithCallbacksTest, handle_rc_ctrl_features) { CHECK(std::future_status::ready == future.wait_for(std::chrono::seconds(2))); auto res = future.get(); LOG_INFO("FEATURES:%d", res.feature); log::info("FEATURES:{}", res.feature); CHECK(res.feature == (BTRC_FEAT_ABSOLUTE_VOLUME | BTRC_FEAT_METADATA | BTRC_FEAT_BROWSE | BTRC_FEAT_COVER_ARTWORK)); } Loading Loading
system/btif/avrcp/avrcp_service.cc +17 −23 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <base/logging.h> #include <base/task/cancelable_task_tracker.h> #include <base/threading/thread.h> #include <bluetooth/log.h> #include <mutex> #include <sstream> Loading Loading @@ -374,7 +375,7 @@ class PlayerSettingsInterfaceWrapper : public PlayerSettingsInterface { void AvrcpService::Init(MediaInterface* media_interface, VolumeInterface* volume_interface, PlayerSettingsInterface* player_settings_interface) { LOG(INFO) << "AVRCP Target Service started"; log::info("AVRCP Target Service started"); profile_version = avrcp_interface_.GetAvrcpVersion(); Loading Loading @@ -435,7 +436,7 @@ uint16_t AvrcpService::GetSupportedFeatures(uint16_t profile_version) { } void AvrcpService::Cleanup() { LOG(INFO) << "AVRCP Target Service stopped"; log::info("AVRCP Target Service stopped"); avrcp_interface_.RemoveRecord(sdp_record_handle); bta_sys_remove_uuid(UUID_SERVCLASS_AV_REM_CTRL_TARGET); Loading @@ -456,8 +457,8 @@ void AvrcpService::Cleanup() { } void AvrcpService::RegisterBipServer(int psm) { LOG(INFO) << "AVRCP Target Service has registered a BIP OBEX server, psm=" << psm; log::info("AVRCP Target Service has registered a BIP OBEX server, psm={}", psm); avrcp_interface_.RemoveRecord(sdp_record_handle); uint16_t supported_features = GetSupportedFeatures(profile_version) | AVRC_SUPF_TG_PLAYER_COVER_ART; Loading @@ -469,7 +470,7 @@ void AvrcpService::RegisterBipServer(int psm) { } void AvrcpService::UnregisterBipServer() { LOG(INFO) << "AVRCP Target Service has unregistered a BIP OBEX server"; log::info("AVRCP Target Service has unregistered a BIP OBEX server"); avrcp_interface_.RemoveRecord(sdp_record_handle); uint16_t supported_features = GetSupportedFeatures(profile_version); sdp_record_handle = get_legacy_stack_sdp_api()->handle.SDP_CreateRecord(); Loading @@ -493,32 +494,27 @@ ServiceInterface* AvrcpService::GetServiceInterface() { } void AvrcpService::ConnectDevice(const RawAddress& bdaddr) { LOG(INFO) << __PRETTY_FUNCTION__ << ": address=" << ADDRESS_TO_LOGGABLE_STR(bdaddr); log::info("address={}", ADDRESS_TO_LOGGABLE_STR(bdaddr)); connection_handler_->ConnectDevice(bdaddr); } void AvrcpService::DisconnectDevice(const RawAddress& bdaddr) { LOG(INFO) << __PRETTY_FUNCTION__ << ": address=" << ADDRESS_TO_LOGGABLE_STR(bdaddr); log::info("address={}", ADDRESS_TO_LOGGABLE_STR(bdaddr)); connection_handler_->DisconnectDevice(bdaddr); } void AvrcpService::SetBipClientStatus(const RawAddress& bdaddr, bool connected) { LOG(INFO) << __PRETTY_FUNCTION__ << ": address=" << ADDRESS_TO_LOGGABLE_STR(bdaddr) << ", connected=" << connected; log::info("address={}, connected={}", ADDRESS_TO_LOGGABLE_STR(bdaddr), connected); connection_handler_->SetBipClientStatus(bdaddr, connected); } void AvrcpService::SendMediaUpdate(bool track_changed, bool play_state, bool queue) { LOG(INFO) << __PRETTY_FUNCTION__ << " track_changed=" << track_changed << " : " << " play_state=" << play_state << " : " << " queue=" << queue; log::info("track_changed={} : play_state={} : queue={}", track_changed, play_state, queue); // This function may be called on any thread, we need to make sure that the // device update happens on the main thread. Loading @@ -532,10 +528,8 @@ void AvrcpService::SendMediaUpdate(bool track_changed, bool play_state, void AvrcpService::SendFolderUpdate(bool available_players, bool addressed_players, bool uids) { LOG(INFO) << __PRETTY_FUNCTION__ << " available_players=" << available_players << " : " << " addressed_players=" << addressed_players << " : " << " uids=" << uids; log::info("available_players={} : addressed_players={} : uids={}", available_players, addressed_players, uids); // Ensure that the update is posted to the correct thread for (const auto& device : Loading @@ -554,7 +548,7 @@ void AvrcpService::SendActiveDeviceChanged(const RawAddress& address) { void AvrcpService::SendPlayerSettingsChanged( std::vector<PlayerAttribute> attributes, std::vector<uint8_t> values) { LOG(INFO) << __PRETTY_FUNCTION__; log::info(""); std::stringstream ss; for (size_t i = 0; i < attributes.size(); i++) { ss << "attribute=" << attributes.at(i) << " : "; Loading @@ -568,7 +562,7 @@ void AvrcpService::SendPlayerSettingsChanged( ss << std::endl; } LOG(INFO) << ss.str(); log::info("{}", ss.str()); // Ensure that the update is posted to the correct thread for (const auto& device : Loading Loading @@ -694,7 +688,7 @@ void AvrcpService::DebugDump(int fd) { /** when a2dp connected, btif will start register vol changed, so we need a * interface for it. */ void AvrcpService::RegisterVolChanged(const RawAddress& bdaddr) { LOG(INFO) << ": address=" << ADDRESS_TO_LOGGABLE_STR(bdaddr); log::info(": address={}", ADDRESS_TO_LOGGABLE_STR(bdaddr)); connection_handler_->RegisterVolChanged(bdaddr); } Loading
system/btif/include/btif_common.h +14 −14 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <base/functional/bind.h> #include <base/location.h> #include <bluetooth/log.h> #include <hardware/bluetooth.h> #include <stdlib.h> Loading @@ -41,8 +42,7 @@ #define ASSERTC(cond, msg, val) \ do { \ if (!(cond)) { \ LOG_ERROR("### ASSERT : %s %s line %d %s (%d) ###", __FILE__, __func__, \ __LINE__, (msg), (val)); \ bluetooth::log::error("### ASSERT : {} ({}) ###", (msg), (val)); \ } \ } while (0) Loading @@ -66,7 +66,7 @@ #define HAL_CBACK(P_CB, P_CBACK, ...) \ do { \ if ((P_CB) && (P_CB)->P_CBACK) { \ LOG_VERBOSE("%s: HAL %s->%s", __func__, #P_CB, #P_CBACK); \ bluetooth::log::verbose("HAL {}->{}", #P_CB, #P_CBACK); \ (P_CB)->P_CBACK(__VA_ARGS__); \ } else { \ ASSERTC(0, "Callback is NULL", 0); \ Loading
system/btif/test/btif_rc_test.cc +3 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #undef LOG_TAG // Undefine the LOG_TAG by this compilation unit #include "btif/src/btif_rc.cc" #include <bluetooth/log.h> #include <gtest/gtest.h> #include <cstdint> Loading Loading @@ -107,7 +108,7 @@ static bluetooth::common::MessageLoopThread jni_thread("bt_jni_thread"); bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { if (!jni_thread.DoInThread(from_here, std::move(task))) { LOG(ERROR) << __func__ << ": Post task to task runner failed!"; log::error("Post task to task runner failed!"); return BT_STATUS_FAIL; } return BT_STATUS_SUCCESS; Loading Loading @@ -264,7 +265,7 @@ TEST_F(BtifRcWithCallbacksTest, handle_rc_ctrl_features) { CHECK(std::future_status::ready == future.wait_for(std::chrono::seconds(2))); auto res = future.get(); LOG_INFO("FEATURES:%d", res.feature); log::info("FEATURES:{}", res.feature); CHECK(res.feature == (BTRC_FEAT_ABSOLUTE_VOLUME | BTRC_FEAT_METADATA | BTRC_FEAT_BROWSE | BTRC_FEAT_COVER_ARTWORK)); } Loading