Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit deee720a authored by Ashutosh Joshi's avatar Ashutosh Joshi Committed by Android (Google) Code Review
Browse files

Merge "Adding a sensor for device pose with six degrees of freedom"

parents 407a385b 17efe02a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13375,6 +13375,7 @@ package android.hardware {
    field public static final java.lang.String STRING_TYPE_MAGNETIC_FIELD = "android.sensor.magnetic_field";
    field public static final java.lang.String STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED = "android.sensor.magnetic_field_uncalibrated";
    field public static final deprecated java.lang.String STRING_TYPE_ORIENTATION = "android.sensor.orientation";
    field public static final java.lang.String STRING_TYPE_POSE_6DOF = "android.sensor.pose_6dof";
    field public static final java.lang.String STRING_TYPE_PRESSURE = "android.sensor.pressure";
    field public static final java.lang.String STRING_TYPE_PROXIMITY = "android.sensor.proximity";
    field public static final java.lang.String STRING_TYPE_RELATIVE_HUMIDITY = "android.sensor.relative_humidity";
@@ -13397,6 +13398,7 @@ package android.hardware {
    field public static final int TYPE_MAGNETIC_FIELD = 2; // 0x2
    field public static final int TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14; // 0xe
    field public static final deprecated int TYPE_ORIENTATION = 3; // 0x3
    field public static final int TYPE_POSE_6DOF = 28; // 0x1c
    field public static final int TYPE_PRESSURE = 6; // 0x6
    field public static final int TYPE_PROXIMITY = 8; // 0x8
    field public static final int TYPE_RELATIVE_HUMIDITY = 12; // 0xc
+2 −0
Original line number Diff line number Diff line
@@ -13772,6 +13772,7 @@ package android.hardware {
    field public static final java.lang.String STRING_TYPE_MAGNETIC_FIELD = "android.sensor.magnetic_field";
    field public static final java.lang.String STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED = "android.sensor.magnetic_field_uncalibrated";
    field public static final deprecated java.lang.String STRING_TYPE_ORIENTATION = "android.sensor.orientation";
    field public static final java.lang.String STRING_TYPE_POSE_6DOF = "android.sensor.pose_6dof";
    field public static final java.lang.String STRING_TYPE_PRESSURE = "android.sensor.pressure";
    field public static final java.lang.String STRING_TYPE_PROXIMITY = "android.sensor.proximity";
    field public static final java.lang.String STRING_TYPE_RELATIVE_HUMIDITY = "android.sensor.relative_humidity";
@@ -13795,6 +13796,7 @@ package android.hardware {
    field public static final int TYPE_MAGNETIC_FIELD = 2; // 0x2
    field public static final int TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14; // 0xe
    field public static final deprecated int TYPE_ORIENTATION = 3; // 0x3
    field public static final int TYPE_POSE_6DOF = 28; // 0x1c
    field public static final int TYPE_PRESSURE = 6; // 0x6
    field public static final int TYPE_PROXIMITY = 8; // 0x8
    field public static final int TYPE_RELATIVE_HUMIDITY = 12; // 0xc
+2 −0
Original line number Diff line number Diff line
@@ -13383,6 +13383,7 @@ package android.hardware {
    field public static final java.lang.String STRING_TYPE_MAGNETIC_FIELD = "android.sensor.magnetic_field";
    field public static final java.lang.String STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED = "android.sensor.magnetic_field_uncalibrated";
    field public static final deprecated java.lang.String STRING_TYPE_ORIENTATION = "android.sensor.orientation";
    field public static final java.lang.String STRING_TYPE_POSE_6DOF = "android.sensor.pose_6dof";
    field public static final java.lang.String STRING_TYPE_PRESSURE = "android.sensor.pressure";
    field public static final java.lang.String STRING_TYPE_PROXIMITY = "android.sensor.proximity";
    field public static final java.lang.String STRING_TYPE_RELATIVE_HUMIDITY = "android.sensor.relative_humidity";
@@ -13405,6 +13406,7 @@ package android.hardware {
    field public static final int TYPE_MAGNETIC_FIELD = 2; // 0x2
    field public static final int TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14; // 0xe
    field public static final deprecated int TYPE_ORIENTATION = 3; // 0x3
    field public static final int TYPE_POSE_6DOF = 28; // 0x1c
    field public static final int TYPE_PRESSURE = 6; // 0x6
    field public static final int TYPE_PROXIMITY = 8; // 0x8
    field public static final int TYPE_RELATIVE_HUMIDITY = 12; // 0xc
+24 −0
Original line number Diff line number Diff line
@@ -551,6 +551,29 @@ public final class Sensor {
     */
    public static final String STRING_TYPE_DEVICE_ORIENTATION = "android.sensor.device_orientation";

     /**
     * A constant describing a pose sensor with 6 degrees of freedom.
     *
     * Similar to {@link #TYPE_ROTATION_VECTOR}, with additional delta
     * translation from an arbitrary reference point.
     *
     * Can use camera, depth sensor etc to compute output value.
     *
     * This is expected to be a high power sensor and expected only to be
     * used when the screen is on.
     *
     * Expected to be more accurate than the rotation vector alone.
     *
     */
    public static final int TYPE_POSE_6DOF = 28;

    /**
     * A constant string describing a pose sensor with 6 degrees of freedom.
     *
     * @see #TYPE_POSE_6DOF
     */
    public static final String STRING_TYPE_POSE_6DOF = "android.sensor.pose_6dof";

    /**
     * A constant describing all sensor types.
     */
@@ -637,6 +660,7 @@ public final class Sensor {
            1, // SENSOR_TYPE_PICK_UP_GESTURE
            1, // SENSOR_TYPE_WRIST_TILT_GESTURE
            1, // SENSOR_TYPE_DEVICE_ORIENTATION
            16, // SENSOR_TYPE_POSE_6DOF
    };

    /**
+34 −0
Original line number Diff line number Diff line
@@ -497,6 +497,40 @@ public class SensorEvent {
     * <li> 3: device is rotated 90 degrees clockwise from default orientation (X axis
     *         is vertical and points down)
     * </ul>
     *
     *   <h4>{@link android.hardware.Sensor#TYPE_POSE_6DOF
     * Sensor.TYPE_POSE_6DOF}:</h4>
     *
     * A TYPE_POSE_6DOF event consists of a rotation expressed as a quaternion and a translation
     * expressed in SI units. The event also contains a delta rotation and translation that show
     * how the device?s pose has changed since the previous sequence numbered pose.
     * The event uses the cannonical Android Sensor axes.
     *
     *
     * <ul>
     *  <li> values[0]: x*sin(&#952/2) </li>
     *  <li> values[1]: y*sin(&#952/2) </li>
     *  <li> values[2]: z*sin(&#952/2) </li>
     *  <li> values[3]: cos(&#952/2)   </li>
     *
     *
     * <li> values[4]: Translation along x axis from an arbitrary origin. </li>
     * li> values[5]: Translation along y axis from an arbitrary origin. </li>
     * <li> values[6]: Translation along z axis from an arbitrary origin. </li>
     *
     * <li> values[7]:  Delta quaternion rotation x*sin(&#952/2) </li>
     * <li> values[8]:  Delta quaternion rotation y*sin(&#952/2) </li>
     * <li> values[9]:  Delta quaternion rotation z*sin(&#952/2) </li>
     * <li> values[10]: Delta quaternion rotation cos(&#952/2) </li>
     *
     * <li> values[11]: Delta translation along x axis. </li>
     * <li> values[12]: Delta translation along y axis. </li>
     * <li> values[13]: Delta translation along z axis. </li>
     *
     * <li> values[14]: Sequence number </li>
     *
     * </ul>
     *
     */
    public final float[] values;