Prevent mEventCache UAF in SensorEventConnection
Since there is no check to see if SensorEventConnection has been
destroyed, the mEventCache pointer can still be used even after it
Test: Run test code that attempts to enable a sensor after destroying
the SensorEventConnection, and verify no system_server crash occurs.
(cherry picked from commit 3e9afc163256db661b9039120d07501b3a8a7d99)
(cherry picked from commit 930b583557e46f14b6d0a0dc1700eb33f18a7714)
2 files changed