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

Commit 394041d9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add hinge angle sensor type to sensors framework"

parents ded9b059 51a0c35b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -16737,6 +16737,7 @@ package android.hardware {
    field public static final String STRING_TYPE_GYROSCOPE_UNCALIBRATED = "android.sensor.gyroscope_uncalibrated";
    field public static final String STRING_TYPE_HEART_BEAT = "android.sensor.heart_beat";
    field public static final String STRING_TYPE_HEART_RATE = "android.sensor.heart_rate";
    field public static final String STRING_TYPE_HINGE_ANGLE = "android.sensor.hinge_angle";
    field public static final String STRING_TYPE_LIGHT = "android.sensor.light";
    field public static final String STRING_TYPE_LINEAR_ACCELERATION = "android.sensor.linear_acceleration";
    field public static final String STRING_TYPE_LOW_LATENCY_OFFBODY_DETECT = "android.sensor.low_latency_offbody_detect";
@@ -16766,6 +16767,7 @@ package android.hardware {
    field public static final int TYPE_GYROSCOPE_UNCALIBRATED = 16; // 0x10
    field public static final int TYPE_HEART_BEAT = 31; // 0x1f
    field public static final int TYPE_HEART_RATE = 21; // 0x15
    field public static final int TYPE_HINGE_ANGLE = 36; // 0x24
    field public static final int TYPE_LIGHT = 5; // 0x5
    field public static final int TYPE_LINEAR_ACCELERATION = 10; // 0xa
    field public static final int TYPE_LOW_LATENCY_OFFBODY_DETECT = 34; // 0x22
+19 −0
Original line number Diff line number Diff line
@@ -692,6 +692,22 @@ public final class Sensor {
    public static final String STRING_TYPE_ACCELEROMETER_UNCALIBRATED =
            "android.sensor.accelerometer_uncalibrated";

    /**
     * A constant describing a hinge angle sensor.
     *
     * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details.
     *
     */
    public static final int TYPE_HINGE_ANGLE = 36;

    /**
     * A constant string describing a hinge angle sensor.
     *
     * @see #TYPE_HINGE_ANGLE
     *
     */
    public static final String STRING_TYPE_HINGE_ANGLE = "android.sensor.hinge_angle";

    /**
     * A constant describing all sensor types.
     */
@@ -811,6 +827,7 @@ public final class Sensor {
            16, // skip over additional sensor info type
            1, // SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT
            6, // SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED
            1, // SENSOR_TYPE_HINGE_ANGLE
    };

    /**
@@ -1226,6 +1243,8 @@ public final class Sensor {
            case TYPE_ACCELEROMETER_UNCALIBRATED:
                mStringType = STRING_TYPE_ACCELEROMETER_UNCALIBRATED;
                return true;
            case TYPE_HINGE_ANGLE:
                mStringType = STRING_TYPE_HINGE_ANGLE;
            default:
                return false;
        }
+10 −0
Original line number Diff line number Diff line
@@ -630,6 +630,16 @@ public class SensorEvent {
     * x_bias, y_bias, z_bias are the estimated biases.
     * </p>
     *
     * <h4>{@link android.hardware.Sensor#TYPE_HINGE_ANGLE Sensor.TYPE_HINGE_ANGLE}:</h4>
     *
     * A sensor of this type measures the angle, in degrees, between two integral parts of the
     * device. Movement of a hinge measured by this sensor type is expected to alter the ways in
     * which the user may interact with the device, for example by unfolding or revealing a display.
     *
     * <ul>
     *  <li> values[0]: Measured hinge angle between 0 and 360 degrees inclusive</li>
     * </ul>
     *
     * @see GeomagneticField
     */
    public final float[] values;