diff --git a/core/api/current.txt b/core/api/current.txt index 12546d81353ab..f30a6eb4fa821 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -16875,12 +16875,16 @@ package android.hardware { field public static final int REPORTING_MODE_ON_CHANGE = 1; // 0x1 field public static final int REPORTING_MODE_SPECIAL_TRIGGER = 3; // 0x3 field public static final String STRING_TYPE_ACCELEROMETER = "android.sensor.accelerometer"; + field public static final String STRING_TYPE_ACCELEROMETER_LIMITED_AXES = "android.sensor.accelerometer_limited_axes"; + field public static final String STRING_TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = "android.sensor.accelerometer_limited_axes_uncalibrated"; field public static final String STRING_TYPE_ACCELEROMETER_UNCALIBRATED = "android.sensor.accelerometer_uncalibrated"; field public static final String STRING_TYPE_AMBIENT_TEMPERATURE = "android.sensor.ambient_temperature"; field public static final String STRING_TYPE_GAME_ROTATION_VECTOR = "android.sensor.game_rotation_vector"; field public static final String STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR = "android.sensor.geomagnetic_rotation_vector"; field public static final String STRING_TYPE_GRAVITY = "android.sensor.gravity"; field public static final String STRING_TYPE_GYROSCOPE = "android.sensor.gyroscope"; + field public static final String STRING_TYPE_GYROSCOPE_LIMITED_AXES = "android.sensor.gyroscope_limited_axes"; + field public static final String STRING_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = "android.sensor.gyroscope_limited_axes_uncalibrated"; field public static final String STRING_TYPE_GYROSCOPE_UNCALIBRATED = "android.sensor.gyroscope_uncalibrated"; field public static final String STRING_TYPE_HEAD_TRACKER = "android.sensor.head_tracker"; field public static final String STRING_TYPE_HEART_BEAT = "android.sensor.heart_beat"; @@ -16904,6 +16908,8 @@ package android.hardware { field public static final String STRING_TYPE_STEP_DETECTOR = "android.sensor.step_detector"; field @Deprecated public static final String STRING_TYPE_TEMPERATURE = "android.sensor.temperature"; field public static final int TYPE_ACCELEROMETER = 1; // 0x1 + field public static final int TYPE_ACCELEROMETER_LIMITED_AXES = 38; // 0x26 + field public static final int TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40; // 0x28 field public static final int TYPE_ACCELEROMETER_UNCALIBRATED = 35; // 0x23 field public static final int TYPE_ALL = -1; // 0xffffffff field public static final int TYPE_AMBIENT_TEMPERATURE = 13; // 0xd @@ -16912,6 +16918,8 @@ package android.hardware { field public static final int TYPE_GEOMAGNETIC_ROTATION_VECTOR = 20; // 0x14 field public static final int TYPE_GRAVITY = 9; // 0x9 field public static final int TYPE_GYROSCOPE = 4; // 0x4 + field public static final int TYPE_GYROSCOPE_LIMITED_AXES = 39; // 0x27 + field public static final int TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41; // 0x29 field public static final int TYPE_GYROSCOPE_UNCALIBRATED = 16; // 0x10 field public static final int TYPE_HEAD_TRACKER = 37; // 0x25 field public static final int TYPE_HEART_BEAT = 31; // 0x1f diff --git a/core/java/android/hardware/Sensor.java b/core/java/android/hardware/Sensor.java index 37cfb4935f0d3..166ae451fb6dd 100644 --- a/core/java/android/hardware/Sensor.java +++ b/core/java/android/hardware/Sensor.java @@ -725,6 +725,74 @@ public final class Sensor { */ public static final String STRING_TYPE_HEAD_TRACKER = "android.sensor.head_tracker"; + /** + * A constant describing a limited axes accelerometer sensor. + * + * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. + * + */ + public static final int TYPE_ACCELEROMETER_LIMITED_AXES = 38; + + /** + * A constant string describing a limited axes accelerometer sensor. + * + * @see #TYPE_ACCELEROMETER_LIMITED_AXES + * + */ + public static final String STRING_TYPE_ACCELEROMETER_LIMITED_AXES = + "android.sensor.accelerometer_limited_axes"; + + /** + * A constant describing a limited axes gyroscope sensor. + * + * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. + * + */ + public static final int TYPE_GYROSCOPE_LIMITED_AXES = 39; + + /** + * A constant string describing a limited axes gyroscope sensor. + * + * @see #TYPE_GYROSCOPE_LIMITED_AXES + * + */ + public static final String STRING_TYPE_GYROSCOPE_LIMITED_AXES = + "android.sensor.gyroscope_limited_axes"; + + /** + * A constant describing an uncalibrated limited axes accelerometer sensor. + * + * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. + * + */ + public static final int TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40; + + /** + * A constant string describing an uncalibrated limited axes accelerometer sensor. + * + * @see #TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED + * + */ + public static final String STRING_TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = + "android.sensor.accelerometer_limited_axes_uncalibrated"; + + /** + * A constant describing an uncalibrated limited axes gyroscope sensor. + * + * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. + * + */ + public static final int TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41; + + /** + * A constant string describing an uncalibrated limited axes gyroscope sensor. + * + * @see #TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED + * + */ + public static final String STRING_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = + "android.sensor.gyroscope_limited_axes_uncalibrated"; + /** * A constant describing all sensor types. */ @@ -846,6 +914,10 @@ public final class Sensor { 6, // SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED 1, // SENSOR_TYPE_HINGE_ANGLE 6, // SENSOR_TYPE_HEAD_TRACKER (discontinuity count is excluded) + 6, // SENSOR_TYPE_ACCELEROMETER_LIMITED_AXES + 6, // SENSOR_TYPE_GYROSCOPE_LIMITED_AXES + 9, // SENSOR_TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED + 9, // SENSOR_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED }; /** @@ -1301,6 +1373,18 @@ public final class Sensor { case TYPE_HEAD_TRACKER: mStringType = STRING_TYPE_HEAD_TRACKER; return true; + case TYPE_ACCELEROMETER_LIMITED_AXES: + mStringType = STRING_TYPE_ACCELEROMETER_LIMITED_AXES; + return true; + case TYPE_GYROSCOPE_LIMITED_AXES: + mStringType = STRING_TYPE_GYROSCOPE_LIMITED_AXES; + return true; + case TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED: + mStringType = STRING_TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED; + return true; + case TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED: + mStringType = STRING_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED; + return true; default: return false; } diff --git a/core/java/android/hardware/SensorEvent.java b/core/java/android/hardware/SensorEvent.java index c77c8cc635e68..7da136f73c533 100644 --- a/core/java/android/hardware/SensorEvent.java +++ b/core/java/android/hardware/SensorEvent.java @@ -676,6 +676,109 @@ public class SensorEvent { *
  • values[5] : Z component of Euler vector representing angular velocity
  • * * + *

    {@link android.hardware.Sensor#TYPE_ACCELEROMETER_LIMITED_AXES + * Sensor.TYPE_ACCELEROMETER_LIMITED_AXES}: + *

    Equivalent to TYPE_ACCELEROMETER, but supporting cases where one + * or two axes are not supported. + * + * The last three values represent whether the acceleration value for a + * given axis is supported. A value of 1.0 indicates that the axis is + * supported, while a value of 0 means it isn't supported. The supported + * axes should be determined at build time and these values do not change + * during runtime. + * + * The acceleration values for axes that are not supported are set to 0. + * + * Similar to {@link android.hardware.Sensor#TYPE_ACCELEROMETER}. + * + * + * + *

    {@link android.hardware.Sensor#TYPE_GYROSCOPE_LIMITED_AXES + * Sensor.TYPE_GYROSCOPE_LIMITED_AXES}: + *

    Equivalent to TYPE_GYROSCOPE, but supporting cases where one or two + * axes are not supported. + * + * The last three values represent whether the angular speed value for a + * given axis is supported. A value of 1.0 indicates that the axis is + * supported, while a value of 0 means it isn't supported. The supported + * axes should be determined at build time and these values do not change + * during runtime. + * + * The angular speed values for axes that are not supported are set to 0. + * + * Similar to {@link android.hardware.Sensor#TYPE_GYROSCOPE}. + * + * + *

    + * + *

    {@link android.hardware.Sensor#TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED + * Sensor.TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED}: + *

    Equivalent to TYPE_ACCELEROMETER_UNCALIBRATED, but supporting cases + * where one or two axes are not supported. + * + * The last three values represent whether the acceleration value for a + * given axis is supported. A value of 1.0 indicates that the axis is + * supported, while a value of 0 means it isn't supported. The supported + * axes should be determined at build time and these values do not change + * during runtime. + * + * The acceleration values and bias values for axes that are not supported + * are set to 0. + * + * + *

    + * + *

    {@link android.hardware.Sensor#TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED + * Sensor.TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED}: + *

    Equivalent to TYPE_GYROSCOPE_UNCALIBRATED, but supporting cases + * where one or two axes are not supported. + * + * The last three values represent whether the angular speed value for a + * given axis is supported. A value of 1.0 indicates that the axis is + * supported, while a value of 0 means it isn't supported. The supported + * axes should be determined at build time and these values do not change + * during runtime. + * + * The angular speed values and drift values for axes that are not supported + * are set to 0. + * + * + *

    + * * @see GeomagneticField */ public final float[] values;