Add HEAD_TRACKER sensor type definition

This new sensor type supports tracking the orientation and rate of
rotation of a user's head, which can be useful for features such as
spatial audio.

Bug: 210156629
Test: compile only; to be validated in later CLs
Change-Id: I861be09d14e208fb992b23554b6c0733e4163f0c
This commit is contained in:
Brian Duddie
2021-12-10 14:24:09 -08:00
parent 21d9695be4
commit d72ba14c90
5 changed files with 90 additions and 2 deletions

View File

@@ -1,5 +1,3 @@
// This is the expected build file, but it may not be right in all cases
aidl_interface {
name: "android.hardware.sensors",
vendor_available: true,

View File

@@ -51,6 +51,7 @@ parcelable Event {
android.hardware.sensors.DynamicSensorInfo dynamic;
android.hardware.sensors.AdditionalInfo additional;
android.hardware.sensors.Event.EventPayload.Data data;
android.hardware.sensors.Event.EventPayload.HeadTracker headTracker;
@FixedSize @VintfStability
parcelable Vec4 {
float x;
@@ -75,6 +76,16 @@ parcelable Event {
float zBias;
}
@FixedSize @VintfStability
parcelable HeadTracker {
float rx;
float ry;
float rz;
float vx;
float vy;
float vz;
int discontinuityCount;
}
@FixedSize @VintfStability
parcelable HeartRate {
float bpm;
android.hardware.sensors.SensorStatus status;

View File

@@ -70,5 +70,6 @@ enum SensorType {
LOW_LATENCY_OFFBODY_DETECT = 34,
ACCELEROMETER_UNCALIBRATED = 35,
HINGE_ANGLE = 36,
HEAD_TRACKER = 37,
DEVICE_PRIVATE_BASE = 65536,
}

View File

@@ -127,6 +127,11 @@ parcelable Event {
*/
Data data;
/**
* SensorType::HEAD_TRACKER
*/
HeadTracker headTracker;
@FixedSize
@VintfStability
parcelable Vec4 {
@@ -156,6 +161,46 @@ parcelable Event {
float zBias;
}
/**
* Payload of the HEAD_TRACKER sensor type. Note that the axis
* definition of this sensor type differs from the rest of Android. See
* SensorType::HEAD_TRACKER for more information.
*/
@FixedSize
@VintfStability
parcelable HeadTracker {
/**
* An Euler vector (rotation vector, i.e. a vector whose direction
* indicates the axis of rotation and magnitude indicates the angle
* to rotate around that axis) representing the transform from
* the (arbitrary, possibly slowly drifting) reference frame to the
* head frame. Expressed in radians. Magnitude of the vector must be
* in the range [0, pi], while the value of individual axes are
* in the range [-pi, pi].
*/
float rx;
float ry;
float rz;
/**
* An Euler vector (rotation vector) representing the angular
* velocity of the head (relative to itself), in radians per second.
* The direction of this vector indicates the axis of rotation, and
* the magnitude indicates the rate of rotation.
*/
float vx;
float vy;
float vz;
/**
* This value increments (or wraps around to 0) each time the
* reference frame is suddenly and significantly changed, for
* example if an orientation filter algorithm used for determining
* the orientation has had its state reset.
*/
int discontinuityCount;
}
@FixedSize
@VintfStability
parcelable HeartRate {

View File

@@ -142,6 +142,10 @@ enum SensorType {
* The rotation vector symbolizes the orientation of the device relative to
* the East-North-Up coordinates frame.
*
* Note that despite the name, SensorType::ROTATION_VECTOR uses
* quaternion representation, rather than the rotation vector representation
* (aka Euler vector) seen in SensorType::HEAD_TRACKER.
*
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
@@ -633,6 +637,35 @@ enum SensorType {
*/
HINGE_ANGLE = 36,
/**
* HEAD_TRACKER
* reporting-mode: continuous
*
* A sensor of this type measures the orientation of a user's head relative
* to an arbitrary reference frame, and the rate of rotation.
*
* Events produced by this sensor follow a special head-centric coordinate
* frame, where:
* - The X axis crosses through the user's ears, with the positive X
* direction extending out of the user's right ear
* - The Y axis crosses from the back of the user's head through their
* nose, with the positive direction extending out of the nose, and the
* X/Y plane being nominally parallel to the ground when the user is
* upright and looking straight ahead
* - The Z axis crosses from the neck through the top of the user's head,
* with the positive direction extending out from the top of the head
*
* When this sensor type is exposed as a dynamic sensor through a
* communications channel that uses HID, such as Bluetooth or USB, as part
* of a device with audio output capability (e.g. headphones), then the
* DynamicSensorInfo::uuid field shall be set to contents of the HID
* Persistent Unique ID to permit association between the sensor and audio
* device. Accordingly, the HID Persistent Unique ID (Sensors Page 0x20,
* Usage ID 0x302) must be populated as a UUID in binary representation,
* following RFC 4122 byte order.
*/
HEAD_TRACKER = 37,
/**
* Base for device manufacturers private sensor types.
* These sensor types can't be exposed in the SDK.