mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Don't modify -1 sensorHandle value
A -1 sensorHandle value is used to denote all active sensors should be stopped for a given channel. Make sure the multi-HAL code doesn't modify handles of this value or it'll corrupt them before passing to the direct channel sub-HAL. Bug: 153413565 Test: atest VtsHalSensorsV2_0Target Change-Id: I3fe9cbf4661aa3db4ff534765d5112a193b7bf4a
This commit is contained in:
@@ -260,9 +260,14 @@ Return<void> HalProxy::configDirectReport(int32_t sensorHandle, int32_t channelH
|
||||
RateLevel rate, configDirectReport_cb _hidl_cb) {
|
||||
if (mDirectChannelSubHal == nullptr) {
|
||||
_hidl_cb(Result::INVALID_OPERATION, -1 /* reportToken */);
|
||||
} else if (sensorHandle == -1 && rate != RateLevel::STOP) {
|
||||
_hidl_cb(Result::BAD_VALUE, -1 /* reportToken */);
|
||||
} else {
|
||||
mDirectChannelSubHal->configDirectReport(clearSubHalIndex(sensorHandle), channelHandle,
|
||||
rate, _hidl_cb);
|
||||
// -1 denotes all sensors should be disabled
|
||||
if (sensorHandle != -1) {
|
||||
sensorHandle = clearSubHalIndex(sensorHandle);
|
||||
}
|
||||
mDirectChannelSubHal->configDirectReport(sensorHandle, channelHandle, rate, _hidl_cb);
|
||||
}
|
||||
return Return<void>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user