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

Commit ee918f91 authored by Matthew Sedam's avatar Matthew Sedam Committed by Android (Google) Code Review
Browse files

Merge "Fix a segmentation fault in NoStaleEvents tests" into main

parents 77b42b15 04cadfcd
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -921,9 +921,15 @@ TEST_P(SensorsAidlTest, NoStaleEvents) {
            continue;
        }

        // Skip sensors with no events
        const std::vector<Event> events = callback.getEvents(sensor.sensorHandle);
        if (events.empty()) {
            continue;
        }

        // Ensure that the first event received is not stale by ensuring that its timestamp is
        // sufficiently different from the previous event
        const Event newEvent = callback.getEvents(sensor.sensorHandle).front();
        const Event newEvent = events.front();
        std::chrono::milliseconds delta =
                duration_cast<std::chrono::milliseconds>(std::chrono::nanoseconds(
                        newEvent.timestamp - lastEventTimestampMap[sensor.sensorHandle]));
+7 −1
Original line number Diff line number Diff line
@@ -806,9 +806,15 @@ TEST_P(SensorsHidlTest, NoStaleEvents) {
            continue;
        }

        // Skip sensors with no events
        const std::vector<EventType> events = callback.getEvents(sensor.sensorHandle);
        if (events.empty()) {
            continue;
        }

        // Ensure that the first event received is not stale by ensuring that its timestamp is
        // sufficiently different from the previous event
        const EventType newEvent = callback.getEvents(sensor.sensorHandle).front();
        const EventType newEvent = events.front();
        milliseconds delta = duration_cast<milliseconds>(
                nanoseconds(newEvent.timestamp - lastEventTimestampMap[sensor.sensorHandle]));
        milliseconds sensorMinDelay = duration_cast<milliseconds>(microseconds(sensor.minDelay));