Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 410d567e authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Fix deadlock on SensorService

If mLock is held by SensorService::threadLoop(), and a new call
from SensorEventConnection comes in to e.g. enable/disable a sensor,
this thread must wait for the mLock to be released. However, if this
thread holds mConnectionLock in SensorEventConnection, and SensorService
invokes SensorEventConnection.sendEvent, the system will come into a
deadlock because both threads are waiting for each other.

To avoid this situation unlock SensotEventConnection's mConnectionLock
while going out of scope.

Also create separate mutexes for modifying mSensorInfo and
mSensorInfoBackup for better separation.

Bug: 153188258
Test: 1) Run sensor logger and enable sensor, put app in background.
      2) Open a_sns_test and start streaming sensor samples
      3) Open app again and verify no system ANR, sensor samples
      continue to be received on app.
Change-Id: If137f39918a8b1148dcc00f1b1d82b4454bb5c7b
parent 584ab0d9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment