Loading services/sensorservice/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ cc_library { "-Wall", "-Werror", "-Wextra", "-Wthread-safety", "-fvisibility=hidden", ], Loading services/sensorservice/SensorEventConnection.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -711,14 +711,17 @@ status_t SensorService::SensorEventConnection::enableDisable( if (err == OK && isSensorCapped) { if ((requestedSamplingPeriodNs >= SENSOR_SERVICE_CAPPED_SAMPLING_PERIOD_NS) || !isRateCappedBasedOnPermission()) { Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup[handle] = requestedSamplingPeriodNs; } else { Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup[handle] = SENSOR_SERVICE_CAPPED_SAMPLING_PERIOD_NS; } } } else { err = mService->disable(this, handle); Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup.erase(handle); } return err; Loading Loading @@ -750,8 +753,10 @@ status_t SensorService::SensorEventConnection::setEventRate(int handle, nsecs_t if (ret == OK && isSensorCapped) { if ((requestedSamplingPeriodNs >= SENSOR_SERVICE_CAPPED_SAMPLING_PERIOD_NS) || !isRateCappedBasedOnPermission()) { Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup[handle] = requestedSamplingPeriodNs; } else { Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup[handle] = SENSOR_SERVICE_CAPPED_SAMPLING_PERIOD_NS; } } Loading services/sensorservice/SensorEventConnection.h +2 −1 Original line number Diff line number Diff line Loading @@ -199,7 +199,8 @@ private: // valid mapping for sensors that require a permission in order to reduce the lookup time. std::unordered_map<int32_t, int32_t> mHandleToAppOp; // Mapping of sensor handles to its rate before being capped by the mic toggle. std::unordered_map<int, nsecs_t> mMicSamplingPeriodBackup; std::unordered_map<int, nsecs_t> mMicSamplingPeriodBackup GUARDED_BY(mConnectionLock); userid_t mUserId; std::optional<bool> mIsRateCappedBasedOnPermission; Loading Loading
services/sensorservice/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ cc_library { "-Wall", "-Werror", "-Wextra", "-Wthread-safety", "-fvisibility=hidden", ], Loading
services/sensorservice/SensorEventConnection.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -711,14 +711,17 @@ status_t SensorService::SensorEventConnection::enableDisable( if (err == OK && isSensorCapped) { if ((requestedSamplingPeriodNs >= SENSOR_SERVICE_CAPPED_SAMPLING_PERIOD_NS) || !isRateCappedBasedOnPermission()) { Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup[handle] = requestedSamplingPeriodNs; } else { Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup[handle] = SENSOR_SERVICE_CAPPED_SAMPLING_PERIOD_NS; } } } else { err = mService->disable(this, handle); Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup.erase(handle); } return err; Loading Loading @@ -750,8 +753,10 @@ status_t SensorService::SensorEventConnection::setEventRate(int handle, nsecs_t if (ret == OK && isSensorCapped) { if ((requestedSamplingPeriodNs >= SENSOR_SERVICE_CAPPED_SAMPLING_PERIOD_NS) || !isRateCappedBasedOnPermission()) { Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup[handle] = requestedSamplingPeriodNs; } else { Mutex::Autolock _l(mConnectionLock); mMicSamplingPeriodBackup[handle] = SENSOR_SERVICE_CAPPED_SAMPLING_PERIOD_NS; } } Loading
services/sensorservice/SensorEventConnection.h +2 −1 Original line number Diff line number Diff line Loading @@ -199,7 +199,8 @@ private: // valid mapping for sensors that require a permission in order to reduce the lookup time. std::unordered_map<int32_t, int32_t> mHandleToAppOp; // Mapping of sensor handles to its rate before being capped by the mic toggle. std::unordered_map<int, nsecs_t> mMicSamplingPeriodBackup; std::unordered_map<int, nsecs_t> mMicSamplingPeriodBackup GUARDED_BY(mConnectionLock); userid_t mUserId; std::optional<bool> mIsRateCappedBasedOnPermission; Loading