summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-04-09 17:14:38 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-09 17:14:38 +0000
commit2adce347223935df0324022e1a52463bfd2dffcc (patch)
treee9ec0c9746235494b224c96644ef790a8b1cce73
parentee01c9ec22b1fd6bc12db85e8007b69b2b9dd12b (diff)
parentcd4d9abdcc710462dfb8efa6ce3f5753f1fc7573 (diff)
downloadplatform_hardware_interfaces-2adce347223935df0324022e1a52463bfd2dffcc.tar.gz
platform_hardware_interfaces-2adce347223935df0324022e1a52463bfd2dffcc.tar.bz2
platform_hardware_interfaces-2adce347223935df0324022e1a52463bfd2dffcc.zip
Merge "Don't modify -1 sensorHandle value" into rvc-dev
-rw-r--r--sensors/common/default/2.X/multihal/HalProxy.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/sensors/common/default/2.X/multihal/HalProxy.cpp b/sensors/common/default/2.X/multihal/HalProxy.cpp
index 518e138f6a..869c0330f4 100644
--- a/sensors/common/default/2.X/multihal/HalProxy.cpp
+++ b/sensors/common/default/2.X/multihal/HalProxy.cpp
@@ -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>();
}