Skip thermal VTS on emulators am: c9e5b146a6 am: c2cfaffb8f

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3487095

Change-Id: I5a9ba99e55ad23e05d27c671df23865af052a99a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
index 7f33e2d..687b5ed 100644
--- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
+++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
@@ -38,6 +38,7 @@
 #include <android/binder_manager.h>
 #include <android/binder_process.h>
 #include <android/binder_status.h>
+#include <cutils/properties.h>
 #include <gtest/gtest.h>
 
 #include <unistd.h>
@@ -175,6 +176,34 @@
             ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
         }
     }
+
+    bool isEmulator() {
+        if (property_get_bool("ro.boot.qemu", false)) {
+            return true;
+        }
+        char device[PROP_VALUE_MAX];
+        char model[PROP_VALUE_MAX];
+        char name[PROP_VALUE_MAX];
+        char hardware[PROP_VALUE_MAX];
+
+        property_get("ro.product.device", device, "");
+        property_get("ro.product.model", model, "");
+        property_get("ro.product.name", name, "");
+        property_get("ro.hardware", hardware, "");
+
+        std::string deviceStr(device);
+        std::string modelStr(model);
+        std::string nameStr(name);
+        std::string hardwareStr(hardware);
+
+        return deviceStr.rfind("vsoc_", 0) == 0 || modelStr.rfind("Cuttlefish ", 0) == 0 ||
+               nameStr.rfind("cf_", 0) == 0 || nameStr.rfind("aosp_cf_", 0) == 0 ||
+               hardwareStr.find("goldfish") != std::string::npos ||
+               hardwareStr.find("ranchu") != std::string::npos ||
+               hardwareStr.find("cutf_cvm") != std::string::npos ||
+               hardwareStr.find("starfish") != std::string::npos;
+    }
+
     // Stores thermal version
     int32_t thermal_version;
 
@@ -355,6 +384,9 @@
     if (apiLevel < 202404) {
         GTEST_SKIP() << "Skipping test as the vendor level is below 202404: " << apiLevel;
     }
+    if (isEmulator()) {
+        GTEST_SKIP() << "Skipping test on emulator";
+    }
     for (const auto& feature : kNonHandheldFeatures) {
         if (::testing::deviceSupportsFeature(feature.c_str())) {
             GTEST_SKIP() << "Skipping test as the device has feature: " << feature;