diff options
author | Anthony Stange <stange@google.com> | 2019-07-01 14:44:50 -0400 |
---|---|---|
committer | Anthony Stange <stange@google.com> | 2019-07-01 21:29:01 +0000 |
commit | 4d904009857a6d62a3838bf167f8542f0495a714 (patch) | |
tree | e5e9c464f10e72ff1243c62c861ab4724e27733e /sensors | |
parent | e7a523a89cb9caac152ae530d15c35078918793c (diff) | |
download | android_hardware_interfaces-4d904009857a6d62a3838bf167f8542f0495a714.tar.gz android_hardware_interfaces-4d904009857a6d62a3838bf167f8542f0495a714.tar.bz2 android_hardware_interfaces-4d904009857a6d62a3838bf167f8542f0495a714.zip |
Deactivate sensors after flush events are received
The VTS flush test case was previously deactivating sensors before
waiting for flush events to be received causing any pending flush events
to be discarded per the HAL contract.
Bug: 136472044
Test: Run test and ensure it passes
Change-Id: I23b94e650c6dbbc33640768bee356a49565ba753
Diffstat (limited to 'sensors')
-rw-r--r-- | sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp index 39053fe75..62c533444 100644 --- a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp +++ b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp @@ -683,11 +683,16 @@ void SensorsHidlTest::runFlushTest(const std::vector<SensorInfo>& sensors, bool Result flushResult = flush(sensor.sensorHandle); ASSERT_EQ(flushResult, expectedResponse); } - activate(sensor.sensorHandle, false); } // Wait up to one second for the flush events callback.waitForFlushEvents(sensors, flushCalls, 1000 /* timeoutMs */); + + // Deactivate all sensors after waiting for flush events so pending flush events are not + // abandoned by the HAL. + for (const SensorInfo& sensor : sensors) { + activate(sensor.sensorHandle, false); + } getEnvironment()->unregisterCallback(); // Check that the correct number of flushes are present for each sensor |