Fix the bug that causes setDelay not working

Fix the bug that causes setDelay not working. Many native sensor
apps, such as camera EIS, still use this API.

Bug: b/27790706
Change-Id: Iaf7eeb3311a2148ca556d27dbd117e1992715644
This commit is contained in:
Peng Xu
2016-03-22 18:44:12 -07:00
parent fc2363284e
commit 2b7c19d0bc
3 changed files with 30 additions and 18 deletions

View File

@@ -580,7 +580,7 @@ int SensorContext::setDelay(int handle, int64_t delayNs) {
continue;
}
if ((sensor.flags & 0xE) == SENSOR_FLAG_CONTINUOUS_MODE) {
if ((sensor.flags & REPORTING_MODE_MASK) == SENSOR_FLAG_CONTINUOUS_MODE) {
if ((delayNs/1000) < sensor.minDelay) {
delayNsClamped = sensor.minDelay * 1000;
} else if ((delayNs/1000) > sensor.maxDelay) {
@@ -624,7 +624,7 @@ int SensorContext::batch(
continue;
}
if ((sensor.flags & 0xE) == SENSOR_FLAG_CONTINUOUS_MODE) {
if ((sensor.flags & REPORTING_MODE_MASK) == SENSOR_FLAG_CONTINUOUS_MODE) {
if ((sampling_period_ns/1000) < sensor.minDelay) {
sampling_period_ns_clamped = sensor.minDelay * 1000;
} else if ((sampling_period_ns/1000) > sensor.maxDelay) {