diff --git a/core/java/android/hardware/Sensor.java b/core/java/android/hardware/Sensor.java index f5fed4f9031dd..bb209f3575da0 100644 --- a/core/java/android/hardware/Sensor.java +++ b/core/java/android/hardware/Sensor.java @@ -52,10 +52,13 @@ public class Sensor { * for more details. */ public static final int TYPE_LIGHT = 5; + /** A constant describing a pressure sensor type */ public static final int TYPE_PRESSURE = 6; + /** A constant describing a temperature sensor type */ public static final int TYPE_TEMPERATURE = 7; + /** * A constant describing an proximity sensor type. * See {@link android.hardware.SensorEvent SensorEvent} diff --git a/core/java/android/hardware/SensorEvent.java b/core/java/android/hardware/SensorEvent.java index 32d56910c3659..9a9f0bfcb1981 100644 --- a/core/java/android/hardware/SensorEvent.java +++ b/core/java/android/hardware/SensorEvent.java @@ -68,27 +68,30 @@ public class SensorEvent { * All values are angles in degrees. * *

values[0]: Azimuth, angle between the magnetic north direction and - * the Y axis, around the Z axis (0 to 359). + * the Y axis, around the Z axis (0 to 359). * 0=North, 90=East, 180=South, 270=West - * + * *

values[1]: Pitch, rotation around X axis (-180 to 180), * with positive values when the z-axis moves toward the y-axis. * *

values[2]: Roll, rotation around Y axis (-90 to 90), with - * positive values when the x-axis moves away from the z-axis. + * positive values when the x-axis moves toward the z-axis. * + *

Important note: For historical reasons the roll angle is + * positive in the clockwise direction (mathematically speaking, it + * should be positive in the counter-clockwise direction). + * *

Note: This definition is different from yaw, pitch and * roll used in aviation where the X axis is along the long side of * the plane (tail to nose). - * - *

Note: It is preferable to use + * + *

Note: This sensor type exists for legacy reasons, please use * {@link android.hardware.SensorManager#getRotationMatrix * getRotationMatrix()} in conjunction with * {@link android.hardware.SensorManager#remapCoordinateSystem * remapCoordinateSystem()} and * {@link android.hardware.SensorManager#getOrientation getOrientation()} - * to compute these values; while it may be more expensive, it is usually - * more accurate. + * to compute these values instead. * *

{@link android.hardware.Sensor#TYPE_ACCELEROMETER Sensor.TYPE_ACCELEROMETER}:

* All values are in SI units (m/s^2) and measure the acceleration applied diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java index 1fe5dc3d68172..aebe84e212020 100644 --- a/core/java/android/hardware/SensorManager.java +++ b/core/java/android/hardware/SensorManager.java @@ -1306,6 +1306,8 @@ public class SensorManager *

  • values[1]: pitch, rotation around the X axis.
  • *
  • values[2]: roll, rotation around the Y axis.
  • *

    + * All three angles above are in radians and positive in the + * counter-clockwise direction. * * @param R rotation matrix see {@link #getRotationMatrix}. * @param values an array of 3 floats to hold the result.