commit | ab8e9f1b2b6e11ff02cee9beff9daf7ac3ad217e | [log] [tgz] |
---|---|---|
author | sangweilin <sangweilin@xiaomi.com> | Mon Mar 20 15:27:18 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Mon Mar 20 15:27:18 2023 +0000 |
tree | 4f5a458c13697bb2c1cf3561e35902f389e9b80a | |
parent | 5fc0541903160e2a395b74b24cf64c7d55bdc426 [diff] | |
parent | e1e361ed439d41af24b01c10cda5f2ecae10abdd [diff] |
catch mutex when notify sampling rate changed, otherwise signal may be lost am: e1e361ed43 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2496635 Change-Id: I43f3932449efa3dbbc530a8050dc7b4c72328dea Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/sensors/common/default/2.X/multihal/tests/fake_subhal/Sensor.cpp b/sensors/common/default/2.X/multihal/tests/fake_subhal/Sensor.cpp index a0bb67a..d8e292a 100644 --- a/sensors/common/default/2.X/multihal/tests/fake_subhal/Sensor.cpp +++ b/sensors/common/default/2.X/multihal/tests/fake_subhal/Sensor.cpp
@@ -76,6 +76,7 @@ static_cast<int64_t>(mSensorInfo.minDelay) * 1000, static_cast<int64_t>(mSensorInfo.maxDelay) * 1000); + std::unique_lock<std::mutex> lock(mRunMutex); if (mSamplingPeriodNs != samplingPeriodNs) { mSamplingPeriodNs = samplingPeriodNs; // Wake up the 'run' thread to check if a new event should be generated now