Add TYPE_HEADING sensor type definitions.
Bug: 189983308
Test: Compile + Presubmits
Change-Id: I6ea82097312d84dc0a3f957f936fec152b566bad
diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl
index 763cb8e..4f49002 100644
--- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl
+++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl
@@ -54,6 +54,7 @@
android.hardware.sensors.Event.EventPayload.HeadTracker headTracker;
android.hardware.sensors.Event.EventPayload.LimitedAxesImu limitedAxesImu;
android.hardware.sensors.Event.EventPayload.LimitedAxesImuUncal limitedAxesImuUncal;
+ android.hardware.sensors.Event.EventPayload.Heading heading;
@FixedSize @VintfStability
parcelable Vec4 {
float x;
@@ -114,6 +115,11 @@
android.hardware.sensors.SensorStatus status;
}
@FixedSize @VintfStability
+ parcelable Heading {
+ float heading;
+ float accuracy;
+ }
+ @FixedSize @VintfStability
parcelable MetaData {
android.hardware.sensors.Event.EventPayload.MetaData.MetaDataEventType what;
@Backing(type="int") @VintfStability
diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl
index 896617b..8c864e9 100644
--- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl
+++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl
@@ -75,5 +75,6 @@
GYROSCOPE_LIMITED_AXES = 39,
ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40,
GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41,
+ HEADING = 42,
DEVICE_PRIVATE_BASE = 65536,
}
diff --git a/sensors/aidl/android/hardware/sensors/Event.aidl b/sensors/aidl/android/hardware/sensors/Event.aidl
index 8b7e409..e8550f1 100644
--- a/sensors/aidl/android/hardware/sensors/Event.aidl
+++ b/sensors/aidl/android/hardware/sensors/Event.aidl
@@ -144,6 +144,11 @@
*/
LimitedAxesImuUncal limitedAxesImuUncal;
+ /**
+ * SensorType::HEADING
+ */
+ Heading heading;
+
@FixedSize
@VintfStability
parcelable Vec4 {
@@ -294,6 +299,27 @@
@FixedSize
@VintfStability
+ parcelable Heading {
+ /**
+ * The direction in which the device is pointing relative to true
+ * north in degrees. The value must be between 0.0 (inclusive) and
+ * 360.0 (exclusive), with 0 indicating north, 90 east, 180 south,
+ * and 270 west.
+ */
+ float heading;
+ /**
+ * Accuracy is defined at 68% confidence. In the case where the
+ * underlying distribution is assumed Gaussian normal, this would be
+ * considered one standard deviation. For example, if the heading
+ * returns 60 degrees, and accuracy returns 10 degrees, then there
+ * is a 68 percent probability of the true heading being between 50
+ * degrees and 70 degrees.
+ */
+ float accuracy;
+ }
+
+ @FixedSize
+ @VintfStability
parcelable MetaData {
MetaDataEventType what;
diff --git a/sensors/aidl/android/hardware/sensors/SensorType.aidl b/sensors/aidl/android/hardware/sensors/SensorType.aidl
index 000728c..9098894 100644
--- a/sensors/aidl/android/hardware/sensors/SensorType.aidl
+++ b/sensors/aidl/android/hardware/sensors/SensorType.aidl
@@ -703,6 +703,21 @@
GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41,
/**
+ * HEADING
+ * reporting-mode: continuous
+ *
+ * A sensor of this type measures the direction in which the device is
+ * pointing relative to true north in degrees.
+ *
+ * This sensor was added for automotive form factors. Other devices with a
+ * clear forward direction might find it useful as well. However, devices
+ * with a more ambiguous orientation such as phones or wearables might want
+ * to consider using other sensors such as Sensor.TYPE_ROTATION_VECTOR
+ * which might be more suitable.
+ */
+ HEADING = 42,
+
+ /**
* Base for device manufacturers private sensor types.
* These sensor types can't be exposed in the SDK.
*/