summaryrefslogtreecommitdiff
path: root/services/sensorservice/SensorService.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-07-10 01:01:58 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-07-10 01:01:58 +0000
commita5546e7c3837675c7bcd04986bddcc0ddf301d36 (patch)
treed3cb8bfa5b44587e0ac8d4b0916e30d035158510 /services/sensorservice/SensorService.cpp
parentd790a82769af41e3939378ef8da68971307248be (diff)
parent9aacd0cffd172b636f55f73fb620375c7c04021f (diff)
downloadnative-a5546e7c3837675c7bcd04986bddcc0ddf301d36.tar.gz
Snap for 6668007 from 9aacd0cffd172b636f55f73fb620375c7c04021f to rvc-release
Change-Id: I0acd8c8d0f3adf80716df925c39faa3e7b4519c5
Diffstat (limited to 'services/sensorservice/SensorService.cpp')
-rw-r--r--services/sensorservice/SensorService.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 26e37aa102..60f9cd90c8 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -1774,7 +1774,10 @@ status_t SensorService::flushSensor(const sp<SensorEventConnection>& connection,
if (halVersion <= SENSORS_DEVICE_API_VERSION_1_0 || isVirtualSensor(handle)) {
// For older devices just increment pending flush count which will send a trivial
// flush complete event.
- connection->incrementPendingFlushCount(handle);
+ if (!connection->incrementPendingFlushCountIfHasAccess(handle)) {
+ ALOGE("flush called on an inaccessible sensor");
+ err = INVALID_OPERATION;
+ }
} else {
if (!canAccessSensor(sensor->getSensor(), "Tried flushing", opPackageName)) {
err = INVALID_OPERATION;