diff options
author | Mathias Agopian <mathias@google.com> | 2010-07-29 16:51:38 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-07-29 18:18:00 -0700 |
commit | 050b56244ff46d43e4886018d7cd20f0b1dc02b9 (patch) | |
tree | 1c0cfcd08dbd18b386bebe5dd2cbeb1c945ccbda /core/java/android/hardware/SensorManager.java | |
parent | 3fb627525e077fa5452a99ac1e2a7e9c41995044 (diff) | |
download | frameworks_base-050b56244ff46d43e4886018d7cd20f0b1dc02b9.zip frameworks_base-050b56244ff46d43e4886018d7cd20f0b1dc02b9.tar.gz frameworks_base-050b56244ff46d43e4886018d7cd20f0b1dc02b9.tar.bz2 |
Added SensorManager.getMinDelay()
Exposed the new "min delay" sensor property through native and
java sensor apis. This allows the caller to know what is the
maximum rate at which a sensor can return events, or, if a sensor
works in "update" mode (events returned only when the value changes).
Also augmented SensorManager.regusterSensorEvent() so that it can
accept a value in microsecond in addition to the 4 constants already
defined.
Change-Id: If425e9979892666df8c989d7de3c362230fa19e0
Diffstat (limited to 'core/java/android/hardware/SensorManager.java')
-rw-r--r-- | core/java/android/hardware/SensorManager.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java index e6750e6..5cc8d5d 100644 --- a/core/java/android/hardware/SensorManager.java +++ b/core/java/android/hardware/SensorManager.java @@ -935,7 +935,8 @@ public class SensorManager * received faster or slower than the specified rate. Usually events * are received faster. The value must be one of * {@link #SENSOR_DELAY_NORMAL}, {@link #SENSOR_DELAY_UI}, - * {@link #SENSOR_DELAY_GAME}, or {@link #SENSOR_DELAY_FASTEST}. + * {@link #SENSOR_DELAY_GAME}, or {@link #SENSOR_DELAY_FASTEST} + * or, the desired delay between events in microsecond. * * @return <code>true</code> if the sensor is supported and successfully * enabled. @@ -967,6 +968,7 @@ public class SensorManager * are received faster. The value must be one of * {@link #SENSOR_DELAY_NORMAL}, {@link #SENSOR_DELAY_UI}, * {@link #SENSOR_DELAY_GAME}, or {@link #SENSOR_DELAY_FASTEST}. + * or, the desired delay between events in microsecond. * * @param handler * The {@link android.os.Handler Handler} the @@ -992,16 +994,17 @@ public class SensorManager delay = 0; break; case SENSOR_DELAY_GAME: - delay = 20; + delay = 20000; break; case SENSOR_DELAY_UI: - delay = 60; + delay = 60000; break; case SENSOR_DELAY_NORMAL: - delay = 200; + delay = 200000; break; default: - return false; + delay = rate; + break; } synchronized (sListeners) { |