Prevent framework from stucking at communicating with HIDL HAL
Sensor hidl service has two threads quota. One is used for sending commands down to hardware, and the other for retrieving sensor events from hardware. The second is usually blocked on poll(). When system server quits abnormaly, the poll thread may still be blocked in HAL implementation and holding that thread. There won't be enough available threads for framework sensor service to function correctly when system service restarts, resulting in a deadlock at enableSensor() or getService() until the hidl service is restarted. This fix detects a second connection from framework sensor service and kills the hidl service in case that happens. The system will restart the hidl service with clean state and return system to normal operation. Bug: 35727090 Bug: 35843387 Bug: 35702298 Bug: 35919167 Bug: 35848670 Bug: 35903635 Test: Restart device works in normal case. Restart also works with the following scenario (reproducing error) "adb root && adb shell dumpsys sensorservice restrict random && adb shell stop && adb shell start" Change-Id: Ibffa87d93b2d24af2803be9281e7141d0a221e3e (cherry picked from commit ab7884fc)
Loading
Please register or sign in to comment