Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: device/generic_sensor/platform_sensor.cc

Issue 2284613002: [sensors] Android platform adaptation for Generic Sensor API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to master. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/generic_sensor/platform_sensor.h ('k') | device/generic_sensor/platform_sensor_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/generic_sensor/platform_sensor.cc
diff --git a/device/generic_sensor/platform_sensor.cc b/device/generic_sensor/platform_sensor.cc
index c982d7713d8b554ee30ce0d551c0fbeff67b3927..bca1fae37f9c6f07d63bd4c62d14b50c622839be 100644
--- a/device/generic_sensor/platform_sensor.cc
+++ b/device/generic_sensor/platform_sensor.cc
@@ -94,4 +94,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
« no previous file with comments | « device/generic_sensor/platform_sensor.h ('k') | device/generic_sensor/platform_sensor_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698