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

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

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: 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/platform_sensor.h » ('j') | device/generic_sensor/platform_sensor.h » ('J')
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..fd98b6f5e835ad9c638610cd80886c3cc6760fa3 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,16 @@ public class PlatformSensor implements SensorEventListener {
}
/**
+ * Returns maximum sampling frequency supported by the sensor.
+ *
+ * @return double frequency in Hz.
+ */
+ @CalledByNative
+ protected double getMaximumSupportedFrequency() {
+ 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/platform_sensor.h » ('j') | device/generic_sensor/platform_sensor.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698