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

Commit 45ca9f58 authored by Peng Xu's avatar Peng Xu
Browse files

[sensorservice] Fix on-change sensor send latest value on enable

This CL correct the behavior of sensorservice so that the latest
value of on-change sensor is send to client when enabling sensor.

The errornous behavior before is that sensorservice send the oldest
value in local cache.

Bug: 28480791
Change-Id: I7e0b8e52fa0be62ba95910789cff1fe0d4fbb03f
parent 99c68bbf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -76,7 +76,8 @@ bool RecentEventLogger::populateLastEvent(sensors_event_t *event) const {
    std::lock_guard<std::mutex> lk(mLock);

    if (mRecentEvents.size()) {
        *event = mRecentEvents[mRecentEvents.size()-1].mEvent;
        // Index 0 contains the latest event emplace()'ed
        *event = mRecentEvents[0].mEvent;
        return true;
    } else {
        return false;