diff options
author | Eva Chen <evaschen@google.com> | 2022-01-10 21:38:51 -0800 |
---|---|---|
committer | Eva Chen <evaschen@google.com> | 2022-01-20 14:21:42 -0800 |
commit | a81deb0fbe90909a17a1a46f5ee9b199cff2d422 (patch) | |
tree | 8ce7fb8c5b966687b41fdb05e3e5c3727c04754e /sensors | |
parent | e1cc317a179ead4be46c7f64364abb5c36d671a2 (diff) |
Add TYPE_HEADING sensor type definitions.
Bug: 189983308
Test: Compile + Presubmits
Change-Id: I6ea82097312d84dc0a3f957f936fec152b566bad
Diffstat (limited to 'sensors')
4 files changed, 48 insertions, 0 deletions
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 763cb8edc6..4f49002fce 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 @@ parcelable Event { 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 @@ parcelable Event { 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 896617beec..8c864e90be 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 @@ enum SensorType { 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 8b7e4097bb..e8550f184b 100644 --- a/sensors/aidl/android/hardware/sensors/Event.aidl +++ b/sensors/aidl/android/hardware/sensors/Event.aidl @@ -144,6 +144,11 @@ parcelable Event { */ LimitedAxesImuUncal limitedAxesImuUncal; + /** + * SensorType::HEADING + */ + Heading heading; + @FixedSize @VintfStability parcelable Vec4 { @@ -294,6 +299,27 @@ parcelable Event { @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 000728c83e..9098894cc7 100644 --- a/sensors/aidl/android/hardware/sensors/SensorType.aidl +++ b/sensors/aidl/android/hardware/sensors/SensorType.aidl @@ -703,6 +703,21 @@ enum SensorType { 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. */ |