Add hinge angle sensor type to sensors framework

Adds new hinge angle sensor type that will expose the angle, in degrees,
between two displays on a device.

Bug: 144139857
Test: Make SDK docs and verify updated wording is present
Change-Id: I20e93bc788f06c4dd48d481c368da01b30cc8d4d
This commit is contained in:
Anthony Stange
2020-01-16 14:56:27 -05:00
parent 5f322de2d6
commit 51a0c35b5a
3 changed files with 31 additions and 0 deletions

View File

@@ -16614,6 +16614,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";
@@ -16643,6 +16644,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

View File

@@ -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;
}

View File

@@ -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;