Do not crash if InputClassifier HAL crashes
If InputClassifier HAL crashes for some reason, we don't have to crash the system. Instead, just check return type and move on. The InputClassifier stage is not critical to input dispatch, and the phone can remain perfectly functional without this stage. Log an error message instead. We are also assuming in InputClassifier that HAL is always present. There are 2 lines of defense here: 1) MotionClassifier always checks the returns from the HAL. If any of the returns are not OK, then MotionClassifier thread exits. This is safe to do always, but a downside of this is that logspam will occur if events are not able to be added to the queue (since the thread that is to be consuming them is no longer running). 2) Register HAL death recipient in InputClassifier. When the HAL death occurs, mMotionClassifier will be set to null, thus preventing further events from going into the queue. This will avoid the logspam from 1). Test: ps -A | grep -i input. Then interact with the phone. Then kill the HAL process, 'killall android.hardware.input.classifier@1.0-service-example'. Then make sure that phone remains functional. Bug: 117935272 Change-Id: I7e8f676d3baa0703198f0731273678c3575bdf60
Loading
Please register or sign in to comment