Add Satellite PVT AIDL HAL
Bug: 171537015
Test: atest VtsHalGnssTargetTest
Change-Id: Icc1f915801d8d3f15757c43abe19f8c264347e22
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
index 73d8a86..7328f7e 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
@@ -42,6 +43,7 @@
double fullInterSignalBiasUncertaintyNs;
double satelliteInterSignalBiasNs;
double satelliteInterSignalBiasUncertaintyNs;
+ android.hardware.gnss.SatellitePvt satellitePvt;
const int HAS_SNR = 1;
const int HAS_CARRIER_FREQUENCY = 512;
const int HAS_CARRIER_CYCLES = 1024;
@@ -52,6 +54,7 @@
const int HAS_FULL_ISB_UNCERTAINTY = 131072;
const int HAS_SATELLITE_ISB = 262144;
const int HAS_SATELLITE_ISB_UNCERTAINTY = 524288;
+ const int HAS_SATELLITE_PVT = 1048576;
const int STATE_UNKNOWN = 0;
const int STATE_CODE_LOCK = 1;
const int STATE_BIT_SYNC = 2;
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
index 62870d6..bf6d3c1 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
@@ -20,4 +21,5 @@
interface IGnssCallback {
void gnssSetCapabilitiesCb(in int capabilities);
const int CAPABILITY_SATELLITE_BLOCKLIST = 1;
+ const int CAPABILITY_SATELLITE_PVT = 8192;
}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteClockInfo.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteClockInfo.aidl
new file mode 100644
index 0000000..bdba667
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteClockInfo.aidl
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+parcelable SatelliteClockInfo {
+ double satHardwareCodeBiasMeters;
+ double satTimeCorrectionMeters;
+ double satClkDriftMps;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePositionEcef.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePositionEcef.aidl
new file mode 100644
index 0000000..550fa4d
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePositionEcef.aidl
@@ -0,0 +1,26 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+parcelable SatellitePositionEcef {
+ double posXMeters;
+ double posYMeters;
+ double posZMeters;
+ double ureMeters;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl
new file mode 100644
index 0000000..4ff025e
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl
@@ -0,0 +1,27 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+parcelable SatellitePvt {
+ android.hardware.gnss.SatellitePositionEcef satPosEcef;
+ android.hardware.gnss.SatelliteVelocityEcef satVelEcef;
+ android.hardware.gnss.SatelliteClockInfo satClockInfo;
+ double ionoDelayMeters;
+ double tropoDelayMeters;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteVelocityEcef.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteVelocityEcef.aidl
new file mode 100644
index 0000000..7db7ee6
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteVelocityEcef.aidl
@@ -0,0 +1,26 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+parcelable SatelliteVelocityEcef {
+ double velXMps;
+ double velYMps;
+ double velZMps;
+ double ureRateMps;
+}
diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
index ce88647..09897fb 100644
--- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
+++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
@@ -18,6 +18,7 @@
import android.hardware.gnss.GnssSignalType;
import android.hardware.gnss.GnssMultipathIndicator;
+import android.hardware.gnss.SatellitePvt;
/**
* Represents a GNSS Measurement, it contains raw and computed information.
@@ -57,6 +58,10 @@
* GnssMeasurement.
*/
const int HAS_SATELLITE_ISB_UNCERTAINTY = 1 << 19;
+ /**
+ * Bit mask indicating a valid satellite PVT is stored in the GnssMeasurement.
+ */
+ const int HAS_SATELLITE_PVT = 1 << 20;
/**
* A bitfield of flags indicating the validity of the fields in this GnssMeasurement. The bit
@@ -612,4 +617,12 @@
* 1-sigma uncertainty associated with the satellite inter-signal bias in nanoseconds.
*/
double satelliteInterSignalBiasUncertaintyNs;
+
+ /**
+ * The GNSS satellite position, velocity and time information at the signal transmission time
+ * receivedSvTimeInNs.
+ *
+ * If the data is available, gnssMeasurementFlags must contain HAS_SATELLITE_PVT.
+ */
+ SatellitePvt satellitePvt;
}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
index a46a018..1ea6faa 100644
--- a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
@@ -30,6 +30,9 @@
/** Capability bit mask indicating GNSS supports blocklisting satellites */
const int CAPABILITY_SATELLITE_BLOCKLIST = 1 << 0;
+ /** Capability bit mask indicating that GNSS supports satellite PVT */
+ const int CAPABILITY_SATELLITE_PVT = 1 << 13;
+
/**
* Callback to inform framework of the GNSS HAL implementation's capabilities.
*
diff --git a/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl b/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl
new file mode 100644
index 0000000..844fd1c
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+/**
+ * Contains estimates of the satellite clock info.
+ */
+@VintfStability
+parcelable SatelliteClockInfo {
+ /**
+ * Satellite hardware code bias of the reported code type w.r.t
+ * ionosphere-free measurement in meters.
+ */
+ double satHardwareCodeBiasMeters;
+
+ /**
+ * Satellite time correction for ionospheric-free signal measurement
+ * (meters). The satellite clock correction for the given signal type
+ * = satTimeCorrectionMeters - satHardwareCodeBiasMeters.
+ */
+ double satTimeCorrectionMeters;
+
+ /** Satellite clock drift (meters per second). */
+ double satClkDriftMps;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/SatellitePositionEcef.aidl b/gnss/aidl/android/hardware/gnss/SatellitePositionEcef.aidl
new file mode 100644
index 0000000..4b3615e
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/SatellitePositionEcef.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+/**
+ * Contains estimates of the satellite position fields in ECEF coordinate frame.
+ */
+@VintfStability
+parcelable SatellitePositionEcef {
+ /** Satellite position X in WGS84 ECEF (meters). */
+ double posXMeters;
+
+ /** Satellite position Y in WGS84 ECEF (meters). */
+ double posYMeters;
+
+ /** Satellite position Z in WGS84 ECEF (meters). */
+ double posZMeters;
+
+ /**
+ * The Signal in Space User Range Error (URE) (meters).
+ *
+ * It covers satellite position and clock errors projected to the pseudorange measurements.
+ */
+ double ureMeters;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl
new file mode 100644
index 0000000..ea55f0c
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.SatellitePositionEcef;
+import android.hardware.gnss.SatelliteVelocityEcef;
+import android.hardware.gnss.SatelliteClockInfo;
+
+/**
+ * Contains estimates of the satellite position, velocity and time in the
+ * ECEF coordinate frame.
+ */
+@VintfStability
+parcelable SatellitePvt {
+ /**
+ * Satellite position in WGS84 ECEF. See comments of
+ * SatellitePositionEcef for units.
+ */
+ SatellitePositionEcef satPosEcef;
+
+ /**
+ * Satellite velocity in WGS84 ECEF. See comments of
+ * SatelliteVelocityEcef for units.
+ */
+ SatelliteVelocityEcef satVelEcef;
+
+ /** Satellite clock bias and drift info. */
+ SatelliteClockInfo satClockInfo;
+
+ /** Ionospheric delay in meters. */
+ double ionoDelayMeters;
+
+ /** Tropospheric delay in meters. */
+ double tropoDelayMeters;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/SatelliteVelocityEcef.aidl b/gnss/aidl/android/hardware/gnss/SatelliteVelocityEcef.aidl
new file mode 100644
index 0000000..25ece3a
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/SatelliteVelocityEcef.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+/**
+ * Contains estimates of the satellite velocity fields in the ECEF coordinate frame.
+ */
+@VintfStability
+parcelable SatelliteVelocityEcef {
+ /** Satellite velocity X in WGS84 ECEF (meters per second). */
+ double velXMps;
+
+ /** Satellite velocity Y in WGS84 ECEF (meters per second). */
+ double velYMps;
+
+ /** Satellite velocity Z in WGS84 ECEF (meters per second). */
+ double velZMps;
+
+ /**
+ * The Signal in Space User Range Error Rate (URE Rate) (meters per second).
+ *
+ * It covers satellite velocity error and Satellite clock drift
+ * projected to the pseudorange rate measurements.
+ */
+ double ureRateMps;
+}
\ No newline at end of file
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 02bad60..661f351 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -36,7 +36,8 @@
sGnssCallback = callback;
- int capabilities = (int)IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST;
+ int capabilities = (int)(IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST |
+ IGnssCallback::CAPABILITY_SATELLITE_PVT);
auto status = sGnssCallback->gnssSetCapabilitiesCb(capabilities);
if (!status.isOk()) {
ALOGE("%s: Unable to invoke callback.gnssSetCapabilities", __func__);
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 857c742..18fda45 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -70,6 +70,7 @@
*/
TEST_P(GnssHalTest, TestGnssMeasurementExtension) {
const int kFirstGnssMeasurementTimeoutSeconds = 10;
+ bool has_capability_satpvt = false;
sp<IGnssMeasurementInterface> iGnssMeasurement;
auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
ASSERT_TRUE(status.isOk());
@@ -102,6 +103,10 @@
GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS |
GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT |
GnssClock::HAS_DRIFT_UNCERTAINTY));
+
+ if (aidl_gnss_cb_->last_capabilities_ & (int)GnssCallbackAidl::CAPABILITY_SATELLITE_PVT) {
+ has_capability_satpvt = true;
+ }
for (const auto& measurement : lastMeasurement.measurements) {
ASSERT_TRUE(
measurement.flags >= 0 &&
@@ -112,7 +117,25 @@
GnssMeasurement::HAS_AUTOMATIC_GAIN_CONTROL |
GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY |
GnssMeasurement::HAS_SATELLITE_ISB |
- GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY));
+ GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY |
+ GnssMeasurement::HAS_SATELLITE_PVT));
+ if ((measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT) &&
+ (has_capability_satpvt == true)) {
+ ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posXMeters >= -43000000 &&
+ measurement.satellitePvt.satPosEcef.posXMeters <= 43000000);
+ ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posYMeters >= -43000000 &&
+ measurement.satellitePvt.satPosEcef.posYMeters <= 43000000);
+ ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posZMeters >= -43000000 &&
+ measurement.satellitePvt.satPosEcef.posZMeters <= 43000000);
+ ASSERT_TRUE(measurement.satellitePvt.satPosEcef.ureMeters > 0);
+ ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velXMps >= -4000 &&
+ measurement.satellitePvt.satVelEcef.velXMps <= 4000);
+ ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velYMps >= -4000 &&
+ measurement.satellitePvt.satVelEcef.velYMps <= 4000);
+ ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velZMps >= -4000 &&
+ measurement.satellitePvt.satVelEcef.velZMps <= 4000);
+ ASSERT_TRUE(measurement.satellitePvt.satVelEcef.ureRateMps > 0);
+ }
}
status = iGnssMeasurement->close();