Merge "Skip event count assertion on reporting mode" into android14-tests-dev am: 70be0c430b

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

Change-Id: Ia3691ea1a06f5c428542a8992a61c8b3ac4c1379
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
index 0b15d12..b1590f9 100644
--- a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
+++ b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
@@ -714,11 +714,14 @@
         return;  // Exit early if setting up the new environment failed
     }
 
+    size_t numNonOneShotAndNonSpecialSensors = getNonOneShotAndNonSpecialSensors().size();
     activateAllSensors(true);
     // Verify that the old environment does not receive any events
     EXPECT_EQ(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), 0);
-    // Verify that the new event queue receives sensor events
-    EXPECT_GE(newEnv.get()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents);
+    if (numNonOneShotAndNonSpecialSensors > 0) {
+        // Verify that the new event queue receives sensor events
+        EXPECT_GE(newEnv.get()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents);
+    }
     activateAllSensors(false);
 
     // Cleanup the test environment
@@ -733,7 +736,9 @@
 
     // Ensure that the original environment is receiving events
     activateAllSensors(true);
-    EXPECT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents);
+    if (numNonOneShotAndNonSpecialSensors > 0) {
+        EXPECT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents);
+    }
     activateAllSensors(false);
 }
 
@@ -743,7 +748,11 @@
     // Verify that events are received
     constexpr useconds_t kCollectionTimeoutUs = 1000 * 1000;  // 1s
     constexpr int32_t kNumEvents = 1;
-    ASSERT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents);
+
+    size_t numNonOneShotAndNonSpecialSensors = getNonOneShotAndNonSpecialSensors().size();
+    if (numNonOneShotAndNonSpecialSensors > 0) {
+        ASSERT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents);
+    }
 
     // Clear the active sensor handles so they are not disabled during TearDown
     auto handles = mSensorHandles;
@@ -757,7 +766,9 @@
     // Verify no events are received until sensors are re-activated
     ASSERT_EQ(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), 0);
     activateAllSensors(true);
-    ASSERT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents);
+    if (numNonOneShotAndNonSpecialSensors > 0) {
+        ASSERT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents);
+    }
 
     // Disable sensors
     activateAllSensors(false);