summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Fennema <fennema@google.com>2019-01-08 17:11:37 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-01-08 17:11:37 -0800
commit2f5bbe8632d2f5057d531137df9c55e46b1b7062 (patch)
treea458d380997fd6e5c006de193cc4066a0836e351
parent4e96a70f33933c2cab08d54e3fc57d3bb694ce96 (diff)
parent77a53f250e2b23f3e7ccbe987736fcefa264e40f (diff)
downloadcontexthub-2f5bbe8632d2f5057d531137df9c55e46b1b7062.tar.gz
sensorhal: fix incorrect rate/latency retention for alt sensors am: 52bd2fa354
am: 77a53f250e Change-Id: Id04a8b57023b196fd37ee19d8f20fc0830032724
-rw-r--r--sensorhal/hubconnection.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/sensorhal/hubconnection.cpp b/sensorhal/hubconnection.cpp
index 83392f21..01a5d2dd 100644
--- a/sensorhal/hubconnection.cpp
+++ b/sensorhal/hubconnection.cpp
@@ -1668,9 +1668,18 @@ void HubConnection::initConfigCmd(struct ConfigCmd *cmd, int handle)
cmd->evtType = EVT_NO_SENSOR_CONFIG_EVENT;
cmd->sensorType = mSensorState[handle].sensorType;
- cmd->cmd = mSensorState[handle].enable ? CONFIG_CMD_ENABLE : CONFIG_CMD_DISABLE;
- cmd->rate = mSensorState[handle].rate;
- cmd->latency = mSensorState[handle].latency;
+
+ if (mSensorState[handle].enable) {
+ cmd->cmd = CONFIG_CMD_ENABLE;
+ cmd->rate = mSensorState[handle].rate;
+ cmd->latency = mSensorState[handle].latency;
+ } else {
+ cmd->cmd = CONFIG_CMD_DISABLE;
+ // set rate and latency to values that will always be overwritten by the
+ // first enabled alt sensor
+ cmd->rate = UINT32_C(0);
+ cmd->latency = UINT64_MAX;
+ }
for (int i=0; i<MAX_ALTERNATES; ++i) {
uint8_t alt = mSensorState[handle].alt[i];