Verify mPollThread is joinable before detaching

If HidlSetUp() bails before startPollingThread() is called (which can
happen if the HAL isn't implemented on the given device), mPollThread
will initialize with the default constructor resulting in joinable()
returning false which means calling detach() throws an exception.

Checking joinable() before detaching allows the test suite to be skipped
successfully.

Fixes: 136736906
Test: Run vts-tradefed on VtsHalSensorsV1_0Target and verify that it is
    skipped successfully on a device that doesn't support HAL 1.0

Change-Id: Ie685ae2dc314edb8df2f3cc7112141a2f5e46008
diff --git a/sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp b/sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp
index affdf8b..fa0e2e9 100644
--- a/sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp
+++ b/sensors/common/vts/utils/SensorsHidlEnvironmentBase.cpp
@@ -29,7 +29,9 @@
 
 void SensorsHidlEnvironmentBase::HidlTearDown() {
     mStopThread = true;
-    mPollThread.detach();
+    if (mPollThread.joinable()) {
+        mPollThread.detach();
+    }
 }
 
 void SensorsHidlEnvironmentBase::catEvents(std::vector<Event>* output) {