diff --git a/system/device/Android.bp b/system/device/Android.bp index 60e9fef306f13c4c87369d98fb87ee080109a580..409989841cc325623c83418ddca14396a8cd1690 100644 --- a/system/device/Android.bp +++ b/system/device/Android.bp @@ -3,6 +3,7 @@ cc_library_static { name: "libbtdevice", defaults: ["fluoride_defaults"], + host_supported: true, local_include_dirs: [ "include", ], diff --git a/system/profile/avrcp/Android.bp b/system/profile/avrcp/Android.bp index d1ce4088aed4ff288cd574a8c9e388a5b4d292d1..00073f8511d94438171055e2c2d99308032b53bf 100644 --- a/system/profile/avrcp/Android.bp +++ b/system/profile/avrcp/Android.bp @@ -38,6 +38,9 @@ cc_test { "libgmock", "lib-bt-packets", "libosi", + "liblog", + "libcutils", + "libbtdevice", "avrcp-target-service", ], sanitize: { diff --git a/system/profile/avrcp/connection_handler.cc b/system/profile/avrcp/connection_handler.cc index 5fc3e7c5769b043d5a8314e9155bb6ae39740728..f6ed8495a211abec1fd49f89c1cf1956597005d3 100644 --- a/system/profile/avrcp/connection_handler.cc +++ b/system/profile/avrcp/connection_handler.cc @@ -28,7 +28,9 @@ // TODO (apanicke): Remove dependency on this header once we cleanup feature // handling. #include "bta/include/bta_av_api.h" +#include "device/include/interop.h" #include "osi/include/allocator.h" +#include "osi/include/properties.h" namespace bluetooth { namespace avrcp { @@ -41,6 +43,20 @@ ConnectionHandler* ConnectionHandler::Get() { return instance_; } +bool IsAbsoluteVolumeEnabled(const RawAddress* bdaddr) { + char volume_disabled[PROPERTY_VALUE_MAX] = {0}; + osi_property_get("persist.bluetooth.disableabsvol", volume_disabled, "false"); + if (strncmp(volume_disabled, "true", 4) == 0) { + LOG(INFO) << "Absolute volume disabled by property"; + return false; + } + if (interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, bdaddr)) { + LOG(INFO) << "Absolute volume disabled by IOP table"; + return false; + } + return true; +} + bool ConnectionHandler::Initialize(const ConnectionCallback& callback, AvrcpInterface* avrcp, SdpInterface* sdp, VolumeInterface* vol) { @@ -429,7 +445,9 @@ void ConnectionHandler::SdpCb(const RawAddress& bdaddr, SdpCallback cb, if (categories & AVRC_SUPF_CT_CAT2) { LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString() << " supports advanced control"; - peer_features |= (BTA_AV_FEAT_ADV_CTRL); + if (IsAbsoluteVolumeEnabled(&bdaddr)) { + peer_features |= (BTA_AV_FEAT_ADV_CTRL); + } } if (categories & AVRC_SUPF_CT_BROWSE) { LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString() @@ -468,7 +486,9 @@ void ConnectionHandler::SdpCb(const RawAddress& bdaddr, SdpCallback cb, if (categories & AVRC_SUPF_CT_CAT2) { LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString() << " supports advanced control"; - peer_features |= (BTA_AV_FEAT_ADV_CTRL); + if (IsAbsoluteVolumeEnabled(&bdaddr)) { + peer_features |= (BTA_AV_FEAT_ADV_CTRL); + } } } }