Add the missing unregisterCallback call

The sensor reading thread continues producing
event and refers to the already destroyed
callback object which causes a crash in
SensorsHidlEnvironmentBase::addEvent.

Bug: 153754380
Test: atest VtsHalSensorsV2_0TargetTest
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Id7fb72c42dc67f89ceef93d937241e1584b853e7
This commit is contained in:
Roman Kiryanov 2020-04-15 10:34:11 -07:00
parent 0260d7d1ee
commit 279a5ae37e

View file

@ -737,6 +737,8 @@ TEST_P(SensorsHidlTest, NoStaleEvents) {
callback.waitForEvents(sensors, kFiveHundredMs + (5 * maxMinDelay));
activateAllSensors(false);
getEnvironment()->unregisterCallback();
for (const SensorInfoType& sensor : sensors) {
// Skip sensors that did not previously report an event
if (lastEventTimestampMap.find(sensor.sensorHandle) == lastEventTimestampMap.end()) {