From 279a5ae37efd63f247162784076c8920da7a1998 Mon Sep 17 00:00:00 2001 From: Roman Kiryanov Date: Wed, 15 Apr 2020 10:34:11 -0700 Subject: [PATCH] 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 Change-Id: Id7fb72c42dc67f89ceef93d937241e1584b853e7 --- sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h index 745ab2d0d9..75f2c28eaf 100644 --- a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h +++ b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h @@ -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()) {