sensorhal: fix incorrect rate/latency retention for alt sensors

When disabling a sensor with alt versions enabled the rate and latency
from the disabled sensor would be used if it was higher (rate) or lower
(latency) than any of the enabled alt versions.

Initialize rate and latency to values such that they will always be
set by the first enabled alt sensor. (0 for rate and max value for

Test: enable accel at 50Hz; enable uncal accel at 200Hz; disable uncal
accel; verify accel is running at 50Hz, not 200Hz
Bug: 122115010
Change-Id: Iac172495235360fbd15bd76abf9b7fdef4d1f6f5
Signed-off-by: Ben Fennema <>
1 file changed