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>
This commit is contained in:
sangweilin
2023-03-20 15:27:18 +00:00
committed by Automerger Merge Worker

View File

@@ -76,6 +76,7 @@ void Sensor::batch(int64_t samplingPeriodNs) {
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