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

Unified Diff: device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comment from Tim Created 4 years, 1 month 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 | « no previous file | device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java
diff --git a/device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java b/device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java
index 2da8e583d0aeb2875e2f46366f49737d634104bf..1d825fe3ac83e358ca644aaa61cbefa298fdf031 100644
--- a/device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java
+++ b/device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java
@@ -22,6 +22,7 @@ import java.util.List;
@JNINamespace("device")
public class PlatformSensor implements SensorEventListener {
private static final double MICROSECONDS_IN_SECOND = 1000000;
+ private static final double SECONDS_IN_MICROSECOND = 0.000001d;
private static final double SECONDS_IN_NANOSECOND = 0.000000001d;
/**
@@ -124,6 +125,17 @@ public class PlatformSensor implements SensorEventListener {
}
/**
+ * Returns maximum sampling frequency supported by the sensor.
+ *
+ * @return double frequency in Hz.
+ */
+ @CalledByNative
+ protected double getMaximumSupportedFrequency() {
+ if (mMinDelayUsec == 0) return getDefaultConfiguration();
+ return 1 / (mMinDelayUsec * SECONDS_IN_MICROSECOND);
+ }
+
+ /**
* Requests sensor to start polling for data.
*
* @return boolean true if successful, false otherwise.
« no previous file with comments | « no previous file | device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698