From d3881ea7fa7afea7d250cdb71448d6d8fcd326af Mon Sep 17 00:00:00 2001 From: Arthur Ishiguro Date: Mon, 15 Oct 2018 15:33:01 -0700 Subject: [PATCH] Updates EventPayload documentation for (Geomag)-RV The former HAL documentation incorrectly documented (Geomag)-RV sensor data as Vec4, although an accuracy field is expected according to the Android sensor docs. Former default HAL implementation has set the accuracy value to zero, preventing apps from getting this value. This change guides OEMs to use the Vec4 + accuracy when converting (Geomag)-RV sensor events. The default HAL implementation passes this extra data now (ag/5224072), but clients of the former implementation will still get the data it needs if assuming the Vec4 sensor data format. Bug: 116874058 Test: Compile only Change-Id: I6a5c8a48dd372c3d4682ed5329f7f87862746cb9 --- current.txt | 1 + sensors/1.0/types.hal | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/current.txt b/current.txt index b34bf8c9c8..1653ac40a2 100644 --- a/current.txt +++ b/current.txt @@ -394,5 +394,6 @@ e22e8135d061d0e9c4c1a70c25c19fdba10f4d3cda9795ef25b6392fc520317c android.hardwar 1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse 271187e261b30c01a33011aea257c07a2d2f05b72943ebee89e973e997849973 android.hardware.radio@1.0::types 1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio +e78cf871f9fd1c072874e481e06e18e2681763cf2aa38c1fd777d53bab4eb69b android.hardware.sensors@1.0::types 1722ad002317b1fae1400de709e90f442d94ef22864e05f7a12af48c32e8edc8 android.hardware.usb@1.1::types 29c8da7a13c40d488f569c812441d5754ee45bdcdb8ce6564f524b708d10a057 android.hardware.vibrator@1.1::types diff --git a/sensors/1.0/types.hal b/sensors/1.0/types.hal index 3926e2f4b1..e91820c377 100644 --- a/sensors/1.0/types.hal +++ b/sensors/1.0/types.hal @@ -1157,8 +1157,7 @@ union EventPayload { Vec3 vec3; /** - * SensorType::ROTATION_VECTOR, SensorType::GAME_ROTATION_VECTOR, - * SensorType::GEOMAGNETIC_ROTATION_VECTOR + * SensorType::GAME_ROTATION_VECTOR */ Vec4 vec4; @@ -1200,7 +1199,14 @@ union EventPayload { /** SensorType::ADDITIONAL_INFO */ AdditionalInfo additional; - /** undefined/custom sensor type >= SensorType::DEVICE_PRIVATE_BASE */ + /** + * The following sensors should use the data field: + * - Undefined/custom sensor type >= SensorType::DEVICE_PRIVATE_BASE + * - SensorType::ROTATION_VECTOR, SensorType::GEOMAGNETIC_ROTATION_VECTOR: + * - These are Vec4 types with an additional float accuracy field, + * where data[4] is the estimated heading accuracy in radians + * (-1 if unavailable, and invalid if not in the range (0, 2 * pi]). + */ float[16] data; };