sensorhal: fix incorrect rate/latency retention for alt sensors

am: 52bd2fa354

Change-Id: Ie85b23403fd2fa83fdcc483b59840e0d54dd520d
This commit is contained in:
Ben Fennema
2019-01-08 17:02:25 -08:00
committed by android-build-merger

View File

@@ -1668,9 +1668,18 @@ void HubConnection::initConfigCmd(struct ConfigCmd *cmd, int handle)
cmd->evtType = EVT_NO_SENSOR_CONFIG_EVENT; cmd->evtType = EVT_NO_SENSOR_CONFIG_EVENT;
cmd->sensorType = mSensorState[handle].sensorType; cmd->sensorType = mSensorState[handle].sensorType;
cmd->cmd = mSensorState[handle].enable ? CONFIG_CMD_ENABLE : CONFIG_CMD_DISABLE;
cmd->rate = mSensorState[handle].rate; if (mSensorState[handle].enable) {
cmd->latency = mSensorState[handle].latency; 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) { for (int i=0; i<MAX_ALTERNATES; ++i) {
uint8_t alt = mSensorState[handle].alt[i]; uint8_t alt = mSensorState[handle].alt[i];