summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Fennema <fennema@google.com>2019-01-08 17:21:39 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-01-08 17:21:39 -0800
commit033a68467bceffd60c7ccd574e88cad6a302d270 (patch)
treea41c1d84b78020a551a27c639a2ac5dd69ae452f
parentc8128f504a5d631624eddea8d804c14fa87df7e0 (diff)
parent2f5bbe8632d2f5057d531137df9c55e46b1b7062 (diff)
downloaddevice_google_contexthub-033a68467bceffd60c7ccd574e88cad6a302d270.tar.gz
device_google_contexthub-033a68467bceffd60c7ccd574e88cad6a302d270.tar.bz2
device_google_contexthub-033a68467bceffd60c7ccd574e88cad6a302d270.zip
sensorhal: fix incorrect rate/latency retention for alt sensors am: 52bd2fa354 am: 77a53f250e
am: 2f5bbe8632 Change-Id: I72bebdba0693bdb459368f96f22deccb973aa1f1
-rw-r--r--sensorhal/hubconnection.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/sensorhal/hubconnection.cpp b/sensorhal/hubconnection.cpp
index 7d558bcb..01c4d2fd 100644
--- a/sensorhal/hubconnection.cpp
+++ b/sensorhal/hubconnection.cpp
@@ -1555,9 +1555,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];