VTS Sensor HAL 2.0: Fix Batch for One Shot sensors

One Shot sensors have minDelay set to -1. Force the minDelay to be 0 in
the VTS test to avoid errors from invalid parameter

Bug: 138758242
Test: Run Batch test manually VtsHalSensorsV2_0TargetTest --gtest_filter=SensorsHidlTest.Batch
Change-Id: Ib2287f6f11502c10d346f5e7216c5f31d585edf9
Merged-In: Ib2287f6f11502c10d346f5e7216c5f31d585edf9
(cherry picked from commit 66d8297210a6deb2e0a8608470780d52c5e09620)
diff --git a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp
index 62c5334..9d2596c 100644
--- a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp
+++ b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp
@@ -761,7 +761,12 @@
     activateAllSensors(false /* enable */);
     for (const SensorInfo& sensor : getSensorsList()) {
         // Call batch on inactive sensor
-        ASSERT_EQ(batch(sensor.sensorHandle, sensor.minDelay, 0 /* maxReportLatencyNs */),
+        // One shot sensors have minDelay set to -1 which is an invalid
+        // parameter. Use 0 instead to avoid errors.
+        int64_t samplingPeriodNs = extractReportMode(sensor.flags) == SensorFlagBits::ONE_SHOT_MODE
+                                           ? 0
+                                           : sensor.minDelay;
+        ASSERT_EQ(batch(sensor.sensorHandle, samplingPeriodNs, 0 /* maxReportLatencyNs */),
                   Result::OK);
 
         // Activate the sensor