diff options
author | Vladimir Komsiyski <vladokom@google.com> | 2023-06-12 10:23:53 +0200 |
---|---|---|
committer | Vladimir Komsiyski <vladokom@google.com> | 2023-06-12 10:50:58 +0200 |
commit | 3b9574a68afb242d573f062ce8e0a99a452d5842 (patch) | |
tree | eabe121239d9c43641f25e2468ac4ad14bc24723 | |
parent | 1dd15d0d52d6975a01cbc5cc3359c9747df5717f (diff) | |
download | native-3b9574a68afb242d573f062ce8e0a99a452d5842.tar.gz |
Handle runtime sensor events even if there are no real ones.
SensorService::threadLoop() "continues" if there are no real sensor
events, which skips the handling of runtime sensor events.
Fix: 281452823
Test: m
Change-Id: I0fe9fe9a7baa19ce9c8cb32d36e736ac83d2fe52
-rw-r--r-- | services/sensorservice/SensorService.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 398d60242b..90d75414d6 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -1055,7 +1055,12 @@ bool SensorService::threadLoop() { if (count < 0) { if(count == DEAD_OBJECT && device.isReconnecting()) { device.reconnect(); - continue; + // There are no "real" events at this point, but do not skip the rest of the loop + // if there are pending runtime events. + Mutex::Autolock _l(&mLock); + if (mRuntimeSensorEventQueue.empty()) { + continue; + } } else { ALOGE("sensor poll failed (%s)", strerror(-count)); break; |