diff options
| author | 2024-07-13 11:40:39 -0700 | |
|---|---|---|
| committer | 2024-07-23 20:07:53 +0000 | |
| commit | 9f5aeb0d8a3adb1e59db9640a60400b9f709ad35 (patch) | |
| tree | 98429893a9268da7afa35d50452f4a37884c1531 | |
| parent | 59856e1a9d03d7ceabd2645e6f7803d6f475fb4e (diff) | |
profile::avrcp Use proper type tSDP_STATUS
Bug: 354043719
Test: m .
Flag: EXEMPT, Proper Data Type
Change-Id: I4ced5d169b453e6257ae221e7f9be911ba3ebb38
| -rw-r--r-- | system/bta/av/bta_av_act.cc | 3 | ||||
| -rw-r--r-- | system/profile/avrcp/avrcp_sdp_records.cc | 1 | ||||
| -rw-r--r-- | system/profile/avrcp/connection_handler.cc | 9 | ||||
| -rw-r--r-- | system/profile/avrcp/connection_handler.h | 6 | ||||
| -rw-r--r-- | system/profile/avrcp/tests/avrcp_connection_handler_test.cc | 19 | ||||
| -rw-r--r-- | system/stack/include/avrc_api.h | 5 | ||||
| -rw-r--r-- | system/test/mock/mock_stack_avrc_sdp.cc | 1 | ||||
| -rw-r--r-- | system/test/mock/mock_stack_avrc_sdp.h | 1 |
8 files changed, 23 insertions, 22 deletions
diff --git a/system/bta/av/bta_av_act.cc b/system/bta/av/bta_av_act.cc index c6f39cce42..00cb80d264 100644 --- a/system/bta/av/bta_av_act.cc +++ b/system/bta/av/bta_av_act.cc @@ -46,6 +46,7 @@ #include "stack/include/btm_client_interface.h" #include "stack/include/l2c_api.h" #include "stack/include/sdp_api.h" +#include "stack/include/sdp_status.h" #include "types/raw_address.h" using namespace bluetooth::legacy::stack::sdp; @@ -199,7 +200,7 @@ static void bta_av_del_sdp_rec(uint32_t* p_sdp_handle) { * Returns void * ******************************************************************************/ -static void bta_av_avrc_sdp_cback(uint16_t /* status */) { +static void bta_av_avrc_sdp_cback(tSDP_STATUS /* status */) { BT_HDR_RIGID* p_msg = (BT_HDR_RIGID*)osi_malloc(sizeof(BT_HDR_RIGID)); p_msg->event = BTA_AV_SDP_AVRC_DISC_EVT; diff --git a/system/profile/avrcp/avrcp_sdp_records.cc b/system/profile/avrcp/avrcp_sdp_records.cc index e587b2a1b0..b58f047422 100644 --- a/system/profile/avrcp/avrcp_sdp_records.cc +++ b/system/profile/avrcp/avrcp_sdp_records.cc @@ -22,6 +22,7 @@ #include "stack/include/avrc_api.h" #include "stack/include/bt_types.h" #include "stack/include/bt_uuid16.h" +#include "stack/include/sdp_api.h" using namespace bluetooth::legacy::stack::sdp; diff --git a/system/profile/avrcp/connection_handler.cc b/system/profile/avrcp/connection_handler.cc index 987b4faaae..334c843ca6 100644 --- a/system/profile/avrcp/connection_handler.cc +++ b/system/profile/avrcp/connection_handler.cc @@ -35,6 +35,7 @@ #include "packet/avrcp/avrcp_packet.h" #include "stack/include/bt_hdr.h" #include "stack/include/bt_uuid16.h" +#include "stack/include/sdp_status.h" #include "types/raw_address.h" extern bool btif_av_peer_is_connected_sink(const RawAddress& peer_address); @@ -134,9 +135,9 @@ bool ConnectionHandler::ConnectDevice(const RawAddress& bdaddr) { } auto connection_lambda = [](ConnectionHandler* instance_, const RawAddress& bdaddr, - uint16_t status, uint16_t version, uint16_t features) { + tSDP_STATUS status, uint16_t version, uint16_t features) { log::info("SDP Completed features=0x{:x}", features); - if (status != AVRC_SUCCESS || !(features & BTA_AV_FEAT_RCCT)) { + if (status != SDP_SUCCESS || !(features & BTA_AV_FEAT_RCCT)) { log::error( "Failed to do SDP: status=0x{:x} features=0x{:x} supports " "controller: {}", @@ -367,7 +368,7 @@ void ConnectionHandler::AcceptorControlCb(uint8_t handle, uint8_t event, uint16_ connection_cb_.Run(newDevice); log::info("Performing SDP on connected device. address={}", *peer_addr); - auto sdp_lambda = [](ConnectionHandler* instance_, uint8_t handle, uint16_t status, + auto sdp_lambda = [](ConnectionHandler* instance_, uint8_t handle, tSDP_STATUS status, uint16_t version, uint16_t features) { if (instance_->device_map_.find(handle) == instance_->device_map_.end()) { log::warn("No device found for handle: 0x{:x}", handle); @@ -473,7 +474,7 @@ void ConnectionHandler::MessageCb(uint8_t handle, uint8_t label, uint8_t opcode, } void ConnectionHandler::SdpCb(RawAddress bdaddr, SdpCallback cb, tSDP_DISCOVERY_DB* disc_db, - bool retry, uint16_t status) { + bool retry, tSDP_STATUS status) { log::verbose("SDP lookup callback received"); if (status == SDP_CONN_FAILED && !retry) { diff --git a/system/profile/avrcp/connection_handler.h b/system/profile/avrcp/connection_handler.h index b4cfd612b2..f91ed8d641 100644 --- a/system/profile/avrcp/connection_handler.h +++ b/system/profile/avrcp/connection_handler.h @@ -24,10 +24,10 @@ #include <vector> #include "avrcp_internal.h" -#include "packet/avrcp/avrcp_packet.h" #include "packet/base/packet.h" #include "profile/avrcp/device.h" #include "raw_address.h" +#include "stack/include/sdp_status.h" namespace bluetooth { namespace avrcp { @@ -144,10 +144,10 @@ private: static ConnectionHandler* instance_; - using SdpCallback = base::Callback<void(uint16_t status, uint16_t version, uint16_t features)>; + using SdpCallback = base::Callback<void(tSDP_STATUS status, uint16_t version, uint16_t features)>; virtual bool SdpLookup(const RawAddress& bdaddr, SdpCallback cb, bool retry); void SdpCb(RawAddress bdaddr, SdpCallback cb, tSDP_DISCOVERY_DB* disc_db, bool retry, - uint16_t status); + tSDP_STATUS status); virtual bool AvrcpConnect(bool initiator, const RawAddress& bdaddr); diff --git a/system/profile/avrcp/tests/avrcp_connection_handler_test.cc b/system/profile/avrcp/tests/avrcp_connection_handler_test.cc index 2d2722ed52..3fbb10ca41 100644 --- a/system/profile/avrcp/tests/avrcp_connection_handler_test.cc +++ b/system/profile/avrcp/tests/avrcp_connection_handler_test.cc @@ -25,6 +25,7 @@ #include "avrcp_test_helper.h" #include "connection_handler.h" #include "sdpdefs.h" +#include "stack/include/sdp_status.h" #include "types/raw_address.h" using ::testing::_; @@ -213,7 +214,7 @@ TEST_F(AvrcpConnectionHandlerTest, remoteDeviceConnectionTest) { conn_cb.ctrl_cback.Run(1, AVRC_OPEN_IND_EVT, 0, &RawAddress::kAny); // Run the SDP callback with status success - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); // Check that a device was created ASSERT_TRUE(current_device_ != nullptr); @@ -255,7 +256,7 @@ TEST_F(AvrcpConnectionHandlerTest, noAbsoluteVolumeTest) { conn_cb.ctrl_cback.Run(1, AVRC_OPEN_IND_EVT, 0, &RawAddress::kAny); // Run the SDP callback with status success - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); // Check that a device was created ASSERT_TRUE(current_device_ != nullptr); @@ -297,7 +298,7 @@ TEST_F(AvrcpConnectionHandlerTest, absoluteVolumeTest) { conn_cb.ctrl_cback.Run(1, AVRC_OPEN_IND_EVT, 0, &RawAddress::kAny); // Run the SDP callback with status success - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); // Check that a device was created ASSERT_TRUE(current_device_ != nullptr); @@ -380,7 +381,7 @@ TEST_F(AvrcpConnectionHandlerTest, multipleRemoteDeviceConnectionTest) { current_device_.reset(); // Run the SDP callback with status success - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); // Set an Expectations that SDP will be performed again SetUpSdp(&sdp_cb, false, false); @@ -397,7 +398,7 @@ TEST_F(AvrcpConnectionHandlerTest, multipleRemoteDeviceConnectionTest) { ASSERT_TRUE(current_device_ != nullptr); // Run the SDP callback with status success - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); connection_handler_ = nullptr; ConnectionHandler::CleanUp(); @@ -451,7 +452,7 @@ TEST_F(AvrcpConnectionHandlerTest, connectToRemoteDeviceTest) { .WillOnce(DoAll(SetArgPointee<0>(1), SaveArgPointee<1>(&conn_cb), Return(0))); // Complete SDP - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); // Check that the callback was sent with us as the initiator ASSERT_EQ(conn_cb.conn, 0); @@ -493,7 +494,7 @@ TEST_F(AvrcpConnectionHandlerTest, connectToBrowsableRemoteDeviceTest) { .WillOnce(DoAll(SetArgPointee<0>(1), SaveArgPointee<1>(&conn_cb), Return(0))); // Complete SDP - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); // Check that the callback was sent with us as the initiator ASSERT_EQ(conn_cb.conn, 0); @@ -543,7 +544,7 @@ TEST_F(AvrcpConnectionHandlerTest, disconnectWhileDoingSdpTest) { conn_cb.ctrl_cback.Run(1, AVRC_CLOSE_IND_EVT, 0, &RawAddress::kAny); // Signal that SDP has completed - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); connection_handler_ = nullptr; ConnectionHandler::CleanUp(); @@ -592,7 +593,7 @@ TEST_F(AvrcpConnectionHandlerTest, connectionCollisionTest) { EXPECT_CALL(mock_avrcp_, Close(_)); // Run the SDP callback with status success - sdp_cb.Run(0); + sdp_cb.Run(SDP_SUCCESS); connection_handler_ = nullptr; ConnectionHandler::CleanUp(); diff --git a/system/stack/include/avrc_api.h b/system/stack/include/avrc_api.h index 0f4496b30e..918bdfb436 100644 --- a/system/stack/include/avrc_api.h +++ b/system/stack/include/avrc_api.h @@ -28,11 +28,10 @@ #include <cstdint> -#include "internal_include/bt_target.h" #include "stack/include/avct_api.h" #include "stack/include/avrc_defs.h" #include "stack/include/bt_hdr.h" -#include "stack/include/sdp_api.h" +#include "stack/include/sdp_status.h" #include "stack/sdp/sdp_discovery_db.h" #include "types/raw_address.h" @@ -212,7 +211,7 @@ typedef struct { * implementation of this callback function must copy the p_service_name * and p_provider_name parameters passed to it as they are not guaranteed * to remain after the callback function exits. */ -using tAVRC_FIND_CBACK = base::Callback<void(uint16_t status)>; +using tAVRC_FIND_CBACK = base::Callback<void(tSDP_STATUS status)>; /* This is the control callback function. This function passes events * listed in Table 20 to the application. */ diff --git a/system/test/mock/mock_stack_avrc_sdp.cc b/system/test/mock/mock_stack_avrc_sdp.cc index e2aab82b3f..8129609f4f 100644 --- a/system/test/mock/mock_stack_avrc_sdp.cc +++ b/system/test/mock/mock_stack_avrc_sdp.cc @@ -29,7 +29,6 @@ // Original usings using bluetooth::Uuid; -using namespace bluetooth::legacy::stack::sdp; // Mocked internal structures, if any diff --git a/system/test/mock/mock_stack_avrc_sdp.h b/system/test/mock/mock_stack_avrc_sdp.h index 506ad7ade0..2334a49b2c 100644 --- a/system/test/mock/mock_stack_avrc_sdp.h +++ b/system/test/mock/mock_stack_avrc_sdp.h @@ -38,7 +38,6 @@ // Original usings using bluetooth::Uuid; -using namespace bluetooth::legacy::stack::sdp; // Mocked compile conditionals, if any |