From a2019c16d5740b387f85a7853dc385e195c6eae3 Mon Sep 17 00:00:00 2001 From: Wally Yau Date: Fri, 10 May 2019 14:25:39 -0700 Subject: [PATCH] Detach pollThread only if it is joinable sensor HAL is not required for Android TV. Hence, ISensors returned from getService() was null and pollThread was not associated with any thread of execution. Bug: 120910004 Test: run vts -m VtsHalSensorsV1_0Target Change-Id: If16af7313ff7bb22e5ca16c03a0fee0b8d733335 --- sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp index c18eedd176..098a24ff5b 100644 --- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp +++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp @@ -105,7 +105,9 @@ void SensorsHidlEnvironment::HidlTearDown() { if (stopThread) { *stopThread = true; } - pollThread.detach(); + if (pollThread.joinable()) { + pollThread.detach(); + } } void SensorsHidlEnvironment::resetHal() {