Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d904009 authored by Anthony Stange's avatar Anthony Stange
Browse files

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
parent e7a523a8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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