| Index: device/generic_sensor/platform_sensor.cc
|
| diff --git a/device/generic_sensor/platform_sensor.cc b/device/generic_sensor/platform_sensor.cc
|
| index 8123b6012b5127a608253a2cad777e1847d076fc..926b5bd5d00c161962c44eb60c087d28d8f1a0bc 100644
|
| --- a/device/generic_sensor/platform_sensor.cc
|
| +++ b/device/generic_sensor/platform_sensor.cc
|
| @@ -88,4 +88,26 @@ void PlatformSensor::NotifySensorError() {
|
| FOR_EACH_OBSERVER(Client, clients_, OnSensorError());
|
| }
|
|
|
| +bool PlatformSensor::UpdateSensorInternal(const ConfigMap& configurations) {
|
| + const PlatformSensorConfiguration* optimal_configuration = nullptr;
|
| + for (const auto& pair : configurations) {
|
| + if (pair.first->IsNotificationSuspended())
|
| + continue;
|
| +
|
| + const auto& conf_list = pair.second;
|
| + for (const auto& configuration : conf_list) {
|
| + if (!optimal_configuration || configuration > *optimal_configuration) {
|
| + optimal_configuration = &configuration;
|
| + }
|
| + }
|
| + }
|
| +
|
| + if (!optimal_configuration) {
|
| + StopSensor();
|
| + return true;
|
| + }
|
| +
|
| + return StartSensor(*optimal_configuration);
|
| +}
|
| +
|
| } // namespace device
|
|
|