Skip to content
Snippets Groups Projects
Commit 9387872d authored by Ted Wang's avatar Ted Wang Committed by Gerrit Code Review
Browse files

Merge "Fix "Disable Absolute Volume" Bluetooth developer option"

parents 72a7366b a7fd72e6
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
cc_library_static { cc_library_static {
name: "libbtdevice", name: "libbtdevice",
defaults: ["fluoride_defaults"], defaults: ["fluoride_defaults"],
host_supported: true,
local_include_dirs: [ local_include_dirs: [
"include", "include",
], ],
......
...@@ -38,6 +38,9 @@ cc_test { ...@@ -38,6 +38,9 @@ cc_test {
"libgmock", "libgmock",
"lib-bt-packets", "lib-bt-packets",
"libosi", "libosi",
"liblog",
"libcutils",
"libbtdevice",
"avrcp-target-service", "avrcp-target-service",
], ],
sanitize: { sanitize: {
......
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
// TODO (apanicke): Remove dependency on this header once we cleanup feature // TODO (apanicke): Remove dependency on this header once we cleanup feature
// handling. // handling.
#include "bta/include/bta_av_api.h" #include "bta/include/bta_av_api.h"
#include "device/include/interop.h"
#include "osi/include/allocator.h" #include "osi/include/allocator.h"
#include "osi/include/properties.h"
namespace bluetooth { namespace bluetooth {
namespace avrcp { namespace avrcp {
...@@ -41,6 +43,20 @@ ConnectionHandler* ConnectionHandler::Get() { ...@@ -41,6 +43,20 @@ ConnectionHandler* ConnectionHandler::Get() {
return instance_; 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, bool ConnectionHandler::Initialize(const ConnectionCallback& callback,
AvrcpInterface* avrcp, SdpInterface* sdp, AvrcpInterface* avrcp, SdpInterface* sdp,
VolumeInterface* vol) { VolumeInterface* vol) {
...@@ -429,7 +445,9 @@ void ConnectionHandler::SdpCb(const RawAddress& bdaddr, SdpCallback cb, ...@@ -429,7 +445,9 @@ void ConnectionHandler::SdpCb(const RawAddress& bdaddr, SdpCallback cb,
if (categories & AVRC_SUPF_CT_CAT2) { if (categories & AVRC_SUPF_CT_CAT2) {
LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString() LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString()
<< " supports advanced control"; << " 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) { if (categories & AVRC_SUPF_CT_BROWSE) {
LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString() LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString()
...@@ -468,7 +486,9 @@ void ConnectionHandler::SdpCb(const RawAddress& bdaddr, SdpCallback cb, ...@@ -468,7 +486,9 @@ void ConnectionHandler::SdpCb(const RawAddress& bdaddr, SdpCallback cb,
if (categories & AVRC_SUPF_CT_CAT2) { if (categories & AVRC_SUPF_CT_CAT2) {
LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString() LOG(INFO) << __PRETTY_FUNCTION__ << ": Device " << bdaddr.ToString()
<< " supports advanced control"; << " supports advanced control";
peer_features |= (BTA_AV_FEAT_ADV_CTRL); if (IsAbsoluteVolumeEnabled(&bdaddr)) {
peer_features |= (BTA_AV_FEAT_ADV_CTRL);
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment