Simplify transport selection logic
Bug: 298450041 Test: Compile Change-Id: I35c7ed3c0a7ba603215b6b2c3fcfb9a7993f5c8e
This commit is contained in:
@@ -1004,9 +1004,6 @@ int HidRawSensor::enable(bool enable) {
|
|||||||
if (device->getFeature(id, &buffer)
|
if (device->getFeature(id, &buffer)
|
||||||
&& (8 * buffer.size()) >=
|
&& (8 * buffer.size()) >=
|
||||||
(mLeTransportBitOffset + mLeTransportBitSize)) {
|
(mLeTransportBitOffset + mLeTransportBitSize)) {
|
||||||
constexpr uint8_t kLeAclValue = 0;
|
|
||||||
constexpr uint8_t kLeIsoValue = 1;
|
|
||||||
|
|
||||||
// The following property, if defined, represents a comma-separated list of
|
// The following property, if defined, represents a comma-separated list of
|
||||||
// transport preferences for the following types: le-acl or iso-[sw|hw],
|
// transport preferences for the following types: le-acl or iso-[sw|hw],
|
||||||
// which describes the priority list of transport selections used based on the
|
// which describes the priority list of transport selections used based on the
|
||||||
@@ -1020,19 +1017,17 @@ int HidRawSensor::enable(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t capability = mFeatureInfo.version & 0x0000FFFF;
|
uint16_t capability = mFeatureInfo.version & 0x0000FFFF;
|
||||||
uint8_t value;
|
uint8_t index;
|
||||||
if (capability == (kIsoBitMask | kAclBitMask)) {
|
if (capability == (kIsoBitMask | kAclBitMask)) {
|
||||||
if (!priorityList.empty() && priorityList[0].compare("le-acl") == 0) {
|
if (!priorityList.empty() && priorityList[0].compare("le-acl") == 0) {
|
||||||
value = kLeAclValue;
|
index = mLeTransportAclIndex;
|
||||||
} else {
|
} else {
|
||||||
value = kLeIsoValue;
|
index = mLeTransportIsoIndex;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
value = (capability & kIsoBitMask) ? kLeIsoValue : kLeAclValue;
|
index = (capability & kIsoBitMask) ? mLeTransportIsoIndex : mLeTransportAclIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t index = (value == kLeAclValue) ? mLeTransportAclIndex :
|
|
||||||
mLeTransportIsoIndex;
|
|
||||||
HidUtil::copyBits(&index, &(buffer[0]), buffer.size(), 0,
|
HidUtil::copyBits(&index, &(buffer[0]), buffer.size(), 0,
|
||||||
mLeTransportBitOffset, mLeTransportBitSize);
|
mLeTransportBitOffset, mLeTransportBitSize);
|
||||||
setLeAudioTransportOk = device->setFeature(id, buffer);
|
setLeAudioTransportOk = device->setFeature(id, buffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user