From 957aa852bb9bd7a70cc4f7f553d4945f3f8da23c Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Fri, 7 Apr 2017 12:52:17 -0700 Subject: Prevent runtime restart for crashed clients to framework sensorservice. This only happens when the client dies, in which case the event queue reference will be dropped on the client side, so the call to handleEvent won't even be fired, except for a race condition. The race condition is, if handleEvent is already fired, then client dies and the event queue is going to be destroyed and the fd is going to be removed, but before that the call onEvent fails. Test: clients of SensorManager that uses event queue no longer crashes. Bug: 35219747 Change-Id: Ibdf062528a219fae65ee6263ed742229ec3cd0d6 --- services/sensorservice/hidl/EventQueue.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/sensorservice/hidl/EventQueue.cpp b/services/sensorservice/hidl/EventQueue.cpp index 86d365c0c2..c0365e503b 100644 --- a/services/sensorservice/hidl/EventQueue.cpp +++ b/services/sensorservice/hidl/EventQueue.cpp @@ -39,7 +39,8 @@ public: while ((actual = internalQueue->read(&event, 1 /* count */)) > 0) { internalQueue->sendAck(&event, actual); - mCallback->onEvent(convertEvent(event)); + Return ret = mCallback->onEvent(convertEvent(event)); + (void)ret.isOk(); // ignored } return 1; // continue to receive callbacks -- cgit v1.2.3-59-g8ed1b