Chromium Code Reviews| 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; |
|
timvolodine
2016/11/03 17:32:55
why not use import java.util.concurrent.TimeUnit f
Mikhail
2016/11/04 21:17:44
That API operates with 'long' type and loses preci
|
| 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. |