Add GnssMeasurement AIDL HAL

BYPASS_INCLUSIVE_LANGUAGE_REASON=refactoring

Bug: 173797017
Test: on cuttlefish
Change-Id: I21de890f1064d761d7ddd1cd73e57396c1974c81
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl
index 354c953..a0e8de4 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl
@@ -21,4 +21,6 @@
   int flags;
   long timestampNs;
   double timeUncertaintyNs;
+  const int HAS_TIMESTAMP_NS = 1;
+  const int HAS_TIME_UNCERTAINTY_NS = 2;
 }
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl
new file mode 100644
index 0000000..42b940e
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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.
+//
+// You must not make a backward incompatible changes to the AIDL files 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 GnssClock {
+  int gnssClockFlags;
+  int leapSecond;
+  long timeNs;
+  double timeUncertaintyNs;
+  long fullBiasNs;
+  double biasNs;
+  double biasUncertaintyNs;
+  double driftNsps;
+  double driftUncertaintyNsps;
+  int hwClockDiscontinuityCount;
+  android.hardware.gnss.GnssSignalType referenceSignalTypeForIsb;
+  const int HAS_LEAP_SECOND = 1;
+  const int HAS_TIME_UNCERTAINTY = 2;
+  const int HAS_FULL_BIAS = 4;
+  const int HAS_BIAS = 8;
+  const int HAS_BIAS_UNCERTAINTY = 16;
+  const int HAS_DRIFT = 32;
+  const int HAS_DRIFT_UNCERTAINTY = 64;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl
new file mode 100644
index 0000000..7ffabd2
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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.
+//
+// You must not make a backward incompatible changes to the AIDL files 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 GnssData {
+  android.hardware.gnss.GnssMeasurement[] measurements;
+  android.hardware.gnss.GnssClock clock;
+  android.hardware.gnss.ElapsedRealtime elapsedRealtime;
+}
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
new file mode 100644
index 0000000..7d15855
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
@@ -0,0 +1,79 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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.
+//
+// You must not make a backward incompatible changes to the AIDL files 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 GnssMeasurement {
+  int flags;
+  int svid;
+  android.hardware.gnss.GnssSignalType signalType;
+  double timeOffsetNs;
+  int state;
+  long receivedSvTimeInNs;
+  long receivedSvTimeUncertaintyInNs;
+  double antennaCN0DbHz;
+  double basebandCN0DbHz;
+  double pseudorangeRateMps;
+  double pseudorangeRateUncertaintyMps;
+  int accumulatedDeltaRangeState;
+  double accumulatedDeltaRangeM;
+  double accumulatedDeltaRangeUncertaintyM;
+  float carrierFrequencyHz;
+  long carrierCycles;
+  double carrierPhase;
+  double carrierPhaseUncertainty;
+  android.hardware.gnss.GnssMultipathIndicator multipathIndicator;
+  double snrDb;
+  double agcLevelDb;
+  double fullInterSignalBiasNs;
+  double fullInterSignalBiasUncertaintyNs;
+  double satelliteInterSignalBiasNs;
+  double satelliteInterSignalBiasUncertaintyNs;
+  const int HAS_SNR = 1;
+  const int HAS_CARRIER_FREQUENCY = 512;
+  const int HAS_CARRIER_CYCLES = 1024;
+  const int HAS_CARRIER_PHASE = 2048;
+  const int HAS_CARRIER_PHASE_UNCERTAINTY = 4096;
+  const int HAS_AUTOMATIC_GAIN_CONTROL = 8192;
+  const int HAS_FULL_ISB = 65536;
+  const int HAS_FULL_ISB_UNCERTAINTY = 131072;
+  const int HAS_SATELLITE_ISB = 262144;
+  const int HAS_SATELLITE_ISB_UNCERTAINTY = 524288;
+  const int STATE_UNKNOWN = 0;
+  const int STATE_CODE_LOCK = 1;
+  const int STATE_BIT_SYNC = 2;
+  const int STATE_SUBFRAME_SYNC = 4;
+  const int STATE_TOW_DECODED = 8;
+  const int STATE_MSEC_AMBIGUOUS = 16;
+  const int STATE_SYMBOL_SYNC = 32;
+  const int STATE_GLO_STRING_SYNC = 64;
+  const int STATE_GLO_TOD_DECODED = 128;
+  const int STATE_BDS_D2_BIT_SYNC = 256;
+  const int STATE_BDS_D2_SUBFRAME_SYNC = 512;
+  const int STATE_GAL_E1BC_CODE_LOCK = 1024;
+  const int STATE_GAL_E1C_2ND_CODE_LOCK = 2048;
+  const int STATE_GAL_E1B_PAGE_SYNC = 4096;
+  const int STATE_SBAS_SYNC = 8192;
+  const int STATE_TOW_KNOWN = 16384;
+  const int STATE_GLO_TOD_KNOWN = 32768;
+  const int STATE_2ND_CODE_LOCK = 65536;
+  const int ADR_STATE_UNKNOWN = 0;
+  const int ADR_STATE_VALID = 1;
+  const int ADR_STATE_RESET = 2;
+  const int ADR_STATE_CYCLE_SLIP = 4;
+  const int ADR_STATE_HALF_CYCLE_RESOLVED = 8;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl
new file mode 100644
index 0000000..75ca3af
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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.
+//
+// You must not make a backward incompatible changes to the AIDL files 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;
+@Backing(type="int") @VintfStability
+enum GnssMultipathIndicator {
+  UNKNOWN = 0,
+  PRESENT = 1,
+  NOT_PRESENT = 2,
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
new file mode 100644
index 0000000..3e66c4a
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
@@ -0,0 +1,40 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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.
+//
+// You must not make a backward incompatible changes to the AIDL files 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 GnssSignalType {
+  android.hardware.gnss.GnssConstellationType constellation;
+  double carrierFrequencyHz;
+  String codeType;
+  const String CODE_TYPE_A = "A";
+  const String CODE_TYPE_B = "B";
+  const String CODE_TYPE_C = "C";
+  const String CODE_TYPE_D = "D";
+  const String CODE_TYPE_I = "I";
+  const String CODE_TYPE_L = "L";
+  const String CODE_TYPE_M = "M";
+  const String CODE_TYPE_N = "N";
+  const String CODE_TYPE_P = "P";
+  const String CODE_TYPE_Q = "Q";
+  const String CODE_TYPE_S = "S";
+  const String CODE_TYPE_W = "W";
+  const String CODE_TYPE_X = "X";
+  const String CODE_TYPE_Y = "Y";
+  const String CODE_TYPE_Z = "Z";
+  const String CODE_TYPE_UNKNOWN = "UNKNOWN";
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
index e1a4b9e..10ac150 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
@@ -22,8 +22,7 @@
   void close();
   android.hardware.gnss.IGnssPsds getExtensionPsds();
   android.hardware.gnss.IGnssConfiguration getExtensionGnssConfiguration();
+  android.hardware.gnss.IGnssMeasurementInterface getExtensionGnssMeasurement();
   android.hardware.gnss.IGnssPowerIndication getExtensionGnssPowerIndication();
   const int ERROR_INVALID_ARGUMENT = 1;
-  const int ELAPSED_REALTIME_HAS_TIMESTAMP_NS = 1;
-  const int ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS = 2;
 }
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl
new file mode 100644
index 0000000..e05e9b9
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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.
+//
+// You must not make a backward incompatible changes to the AIDL files 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
+interface IGnssMeasurementCallback {
+  void gnssMeasurementCb(in android.hardware.gnss.GnssData data);
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl
new file mode 100644
index 0000000..9576205
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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.
+//
+// You must not make a backward incompatible changes to the AIDL files 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
+interface IGnssMeasurementInterface {
+  void setCallback(in android.hardware.gnss.IGnssMeasurementCallback callback, in boolean enableFullTracking);
+  void close();
+}
diff --git a/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl
index fae14f8..67d090e 100644
--- a/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl
+++ b/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl
@@ -22,10 +22,18 @@
 @VintfStability
 parcelable ElapsedRealtime {
 
+    /** Bit mask indicating a valid timestampNs is stored in the ElapsedRealtime parcelable. */
+    const int HAS_TIMESTAMP_NS = 1 << 0;
+
+    /**
+     * Bit mask indicating a valid timeUncertaintyNs is stored in the ElapsedRealtime parcelable.
+     */
+    const int HAS_TIME_UNCERTAINTY_NS = 1 << 1;
+
     /**
      * A bit field of flags indicating the validity of each field in this data structure.
      *
-     * The bit masks are defined in IGnss interface and prefixed with ELAPSED_REALTIME_HAS_.
+     * The bit masks are the constants with prefix HAS_.
      *
      * Fields may have invalid information in them, if not marked as valid by the corresponding bit
      * in flags.
diff --git a/gnss/aidl/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/android/hardware/gnss/GnssClock.aidl
new file mode 100644
index 0000000..f416e08
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssClock.aidl
@@ -0,0 +1,203 @@
+/*
+ * 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.GnssSignalType;
+
+/**
+ * Represents an estimate of the GNSS clock time.
+ */
+@VintfStability
+parcelable GnssClock {
+    /** Bit mask indicating a valid 'leap second' is stored in the GnssClock. */
+    const int HAS_LEAP_SECOND        = 1 << 0;
+    /** Bit mask indicating a valid 'time uncertainty' is stored in the GnssClock. */
+    const int HAS_TIME_UNCERTAINTY   = 1 << 1;
+    /** Bit mask indicating a valid 'full bias' is stored in the GnssClock. */
+    const int HAS_FULL_BIAS          = 1 << 2;
+    /** Bit mask indicating a valid 'bias' is stored in the GnssClock. */
+    const int HAS_BIAS               = 1 << 3;
+    /** Bit mask indicating a valid 'bias uncertainty' is stored in the GnssClock. */
+    const int HAS_BIAS_UNCERTAINTY   = 1 << 4;
+    /** Bit mask indicating a valid 'drift' is stored in the GnssClock. */
+    const int HAS_DRIFT              = 1 << 5;
+    /** Bit mask indicating a valid 'drift uncertainty' is stored in the GnssClock. */
+    const int HAS_DRIFT_UNCERTAINTY  = 1 << 6;
+
+    /**
+     * A bitfield of flags indicating the validity of the fields in this data
+     * structure.
+     *
+     * The bit masks are the constants with perfix HAS_.
+     *
+     * Fields for which there is no corresponding flag must be filled in
+     * with a valid value.  For convenience, these are marked as mandatory.
+     *
+     * Others fields may have invalid information in them, if not marked as
+     * valid by the corresponding bit in gnssClockFlags.
+     */
+    int gnssClockFlags;
+
+    /**
+     * Leap second data.
+     * The sign of the value is defined by the following equation:
+     *      utcTimeNs = timeNs - (fullBiasNs + biasNs) - leapSecond *
+     *      1,000,000,000
+     *
+     * If this data is available, gnssClockFlags must contain
+     * HAS_LEAP_SECOND.
+     */
+    int leapSecond;
+
+    /**
+     * The GNSS receiver internal clock value. This is the local hardware clock
+     * value.
+     *
+     * For local hardware clock, this value is expected to be monotonically
+     * increasing while the hardware clock remains powered on. (For the case of a
+     * HW clock that is not continuously on, see the
+     * hwClockDiscontinuityCount field). The receiver's estimate of GNSS time
+     * can be derived by subtracting the sum of fullBiasNs and biasNs (when
+     * available) from this value.
+     *
+     * This GNSS time must be the best estimate of current GNSS time
+     * that GNSS receiver can achieve.
+     *
+     * Sub-nanosecond accuracy can be provided by means of the 'biasNs' field.
+     * The value contains the timeUncertaintyNs in it.
+     *
+     * This value is mandatory.
+     */
+    long timeNs;
+
+    /**
+     * 1-Sigma uncertainty associated with the clock's time in nanoseconds.
+     * The uncertainty is represented as an absolute (single sided) value.
+     *
+     * If the data is available, gnssClockFlags must contain
+     * HAS_TIME_UNCERTAINTY. Ths value is ideally zero, as the time
+     * 'latched' by timeNs is defined as the reference clock vs. which all
+     * other times (and corresponding uncertainties) are measured.
+     */
+    double timeUncertaintyNs;
+
+    /**
+     * The difference between hardware clock ('time' field) inside GNSS receiver
+     * and the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
+     *
+     * The sign of the value is defined by the following equation:
+     *      local estimate of GPS time = timeNs - (fullBiasNs + biasNs)
+     *
+     * If receiver has computed time for a non-GPS constellation, the time offset of
+     * that constellation versus GPS time must be applied to fill this value.
+     *
+     * The error estimate for the sum of this and the biasNs is the biasUncertaintyNs.
+     *
+     * If the data is available gnssClockFlags must contain HAS_FULL_BIAS.
+     *
+     * This value is mandatory if the receiver has estimated GPS time.
+     */
+    long fullBiasNs;
+
+    /**
+     * Sub-nanosecond bias - used with fullBiasNS, see fullBiasNs for details.
+     *
+     * The error estimate for the sum of this and the fullBiasNs is the
+     * biasUncertaintyNs.
+     *
+     * If the data is available gnssClockFlags must contain HAS_BIAS.
+     *
+     * This value is mandatory if the receiver has estimated GPS time.
+     */
+    double biasNs;
+
+    /**
+     * 1-Sigma uncertainty associated with the local estimate of GNSS time (clock
+     * bias) in nanoseconds. The uncertainty is represented as an absolute
+     * (single sided) value.
+     *
+     * The caller is responsible for using this uncertainty (it can be very
+     * large before the GPS time has been fully resolved.)
+     *
+     * If the data is available gnssClockFlags must contain HAS_BIAS_UNCERTAINTY.
+     *
+     * This value is mandatory if the receiver has estimated GPS time.
+     */
+    double biasUncertaintyNs;
+
+    /**
+     * The clock's drift in nanoseconds (per second).
+     *
+     * A positive value means that the frequency is higher than the nominal
+     * frequency, and that the (fullBiasNs + biasNs) is growing more positive
+     * over time.
+     *
+     * If the data is available gnssClockFlags must contain HAS_DRIFT.
+     *
+     * This value is mandatory if the receiver has estimated GPS time.
+     */
+    double driftNsps;
+
+    /**
+     * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per
+     * second).
+     * The uncertainty is represented as an absolute (single sided) value.
+     *
+     * If the data is available gnssClockFlags must contain HAS_DRIFT_UNCERTAINTY.
+     *
+     * This value is mandatory if the receiver has estimated GPS time.
+     */
+    double driftUncertaintyNsps;
+
+    /**
+     * This field must be incremented, when there are discontinuities in the
+     * hardware clock.
+     *
+     * A "discontinuity" is meant to cover the case of a switch from one source
+     * of clock to another.  A single free-running crystal oscillator (XO)
+     * will generally not have any discontinuities, and this can be set and
+     * left at 0.
+     *
+     * If, however, the timeNs value (HW clock) is derived from a composite of
+     * sources, that is not as smooth as a typical XO, or is otherwise stopped &
+     * restarted, then this value shall be incremented each time a discontinuity
+     * occurs.  (E.g. this value can start at zero at device boot-up and
+     * increment each time there is a change in clock continuity. In the
+     * unlikely event that this value reaches full scale, rollover (not
+     * clamping) is required, such that this value continues to change, during
+     * subsequent discontinuity events.)
+     *
+     * While this number stays the same, between GnssClock reports, it can be
+     * safely assumed that the timeNs value has been running continuously, e.g.
+     * derived from a single, high quality clock (XO like, or better, that is
+     * typically used during continuous GNSS signal sampling.)
+     *
+     * It is expected, esp. during periods where there are few GNSS signals
+     * available, that the HW clock be discontinuity-free as long as possible,
+     * as this avoids the need to use (waste) a GNSS measurement to fully
+     * re-solve for the GNSS clock bias and drift, when using the accompanying
+     * measurements, from consecutive GnssData reports.
+     *
+     * This value is mandatory.
+     */
+    int hwClockDiscontinuityCount;
+
+    /**
+     * Reference GNSS signal type for inter-signal bias.
+     */
+    GnssSignalType referenceSignalTypeForIsb;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssData.aidl b/gnss/aidl/android/hardware/gnss/GnssData.aidl
new file mode 100644
index 0000000..ed30c98
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssData.aidl
@@ -0,0 +1,44 @@
+/*
+ * 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.ElapsedRealtime;
+import android.hardware.gnss.GnssClock;
+import android.hardware.gnss.GnssMeasurement;
+
+/**
+ * Represents a reading of GNSS measurements. For devices launched in Android Q or newer, it is
+ * mandatory that these be provided, on request, when the GNSS receiver is searching/tracking
+ * signals.
+ *
+ * - Reporting of GNSS constellation measurements is mandatory.
+ * - Reporting of all tracked constellations are encouraged.
+ */
+@VintfStability
+parcelable GnssData {
+    /** The array of measurements. */
+    GnssMeasurement[] measurements;
+
+    /** The GNSS clock time reading. */
+    GnssClock clock;
+
+    /**
+     * Timing information of the GNSS data synchronized with SystemClock.elapsedRealtimeNanos()
+     * clock.
+     */
+    ElapsedRealtime elapsedRealtime;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
new file mode 100644
index 0000000..fae862b
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
@@ -0,0 +1,634 @@
+/*
+ * 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.GnssConstellationType;
+import android.hardware.gnss.GnssSignalType;
+import android.hardware.gnss.GnssMultipathIndicator;
+
+/**
+ * Represents a GNSS Measurement, it contains raw and computed information.
+ *
+ * All signal measurement information (e.g. svTime, pseudorangeRate, multipathIndicator) reported in
+ * this struct must be based on GNSS signal measurements only. You must not synthesize measurements
+ * by calculating or reporting expected measurements based on known or estimated position, velocity,
+ * or time.
+ */
+@VintfStability
+parcelable GnssMeasurement {
+    /** Bit mask indicating a valid 'snr' is stored in the GnssMeasurement. */
+    const int HAS_SNR                        = 1 << 0;
+    /** Bit mask indicating a valid 'carrier frequency' is stored in the GnssMeasurement. */
+    const int HAS_CARRIER_FREQUENCY          = 1 << 9;
+    /** Bit mask indicating a valid 'carrier cycles' is stored in the GnssMeasurement. */
+    const int HAS_CARRIER_CYCLES             = 1 << 10;
+    /** Bit mask indicating a valid 'carrier phase' is stored in the GnssMeasurement. */
+    const int HAS_CARRIER_PHASE              = 1 << 11;
+    /** Bit mask indicating a valid 'carrier phase uncertainty' is stored in the GnssMeasurement. */
+    const int HAS_CARRIER_PHASE_UNCERTAINTY  = 1 << 12;
+    /** Bit mask indicating a valid automatic gain control is stored in the GnssMeasurement. */
+    const int HAS_AUTOMATIC_GAIN_CONTROL     = 1 << 13;
+    /** Bit mask indicating a valid full inter-signal bias is stored in the GnssMeasurement. */
+    const int HAS_FULL_ISB                   = 1 << 16;
+    /**
+     * Bit mask indicating a valid full inter-signal bias uncertainty is stored in the
+     * GnssMeasurement.
+     */
+    const int HAS_FULL_ISB_UNCERTAINTY       = 1 << 17;
+    /**
+     * Bit mask indicating a valid satellite inter-signal bias is stored in the GnssMeasurement.
+     */
+    const int HAS_SATELLITE_ISB              = 1 << 18;
+    /**
+     * Bit mask indicating a valid satellite inter-signal bias uncertainty is stored in the
+     * GnssMeasurement.
+     */
+    const int HAS_SATELLITE_ISB_UNCERTAINTY  = 1 << 19;
+
+    /**
+     * A bitfield of flags indicating the validity of the fields in this GnssMeasurement. The bit
+     * masks are defined in the constants with prefix HAS_*
+     *
+     * Fields for which there is no corresponding flag must be filled in with a valid value.  For
+     * convenience, these are marked as mandatory.
+     *
+     * Others fields may have invalid information in them, if not marked as valid by the
+     * corresponding bit in flags.
+     */
+    int flags;
+
+    /**
+     * Satellite vehicle ID number, as defined in GnssSvInfo::svid
+     *
+     * This value is mandatory.
+     */
+    int svid;
+
+    /**
+     * Defines the constellation of the given SV.
+     *
+     * This value is mandatory.
+     */
+    GnssSignalType signalType;
+
+    /**
+     * Time offset at which the measurement was taken in nanoseconds.
+     * The reference receiver's time is specified by GnssData::clock::timeNs.
+     *
+     * The sign of timeOffsetNs is given by the following equation:
+     *      measurement time = GnssClock::timeNs + timeOffsetNs
+     *
+     * It provides an individual time-stamp for the measurement, and allows
+     * sub-nanosecond accuracy. It may be zero if all measurements are
+     * aligned to a common time.
+     *
+     * This value is mandatory.
+     */
+    double timeOffsetNs;
+
+    /**
+     * Flags indicating the GNSS measurement state.
+     *
+     * The expected behavior here is for GNSS HAL to set all the flags that apply. For example, if
+     * the state for a satellite is only C/A code locked and bit synchronized, and there is still
+     * millisecond ambiguity, the state must be set as:
+     *
+     * STATE_CODE_LOCK | STATE_BIT_SYNC |  STATE_MSEC_AMBIGUOUS
+     *
+     * If GNSS is still searching for a satellite, the corresponding state must be set to
+     * STATE_UNKNOWN(0).
+     *
+     * The received satellite time is relative to the beginning of the system week for all
+     * constellations except for Glonass where it is relative to the beginning of the Glonass system
+     * day.
+     *
+     * The table below indicates the valid range of the received GNSS satellite time.  These ranges
+     * depend on the constellation and code being tracked and the state of the tracking algorithms
+     * given by the getState method. If the state flag is set, then the valid measurement range is
+     * zero to the value in the table. The state flag with the widest range indicates the range of
+     * the received GNSS satellite time value.
+     *
+     * +---------------------------+--------------------+-----+-----------+--------------------+------+
+     * |                           |GPS/QZSS	        |GLNS |BDS        |GAL                 |SBAS  |
+     * +---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |State Flag	               |L1    |L5I   |L5Q   |L1OF |B1I   |B1I |E1B   |E1C   |E5AQ  |L1    |
+     * |                           |C/A	  |      |      |     |(D1)  |(D2)|      |      |      |C/A   |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_UNKNOWN              |0	  |0	 |0	    |0	  |0	 |0   |0     |0     |0	   |0     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_CODE_LOCK            |1ms   |1 ms  |1 ms  |1 ms |1 ms  |1 ms|-     |-     |1 ms  |1 ms  |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_SYMBOL_SYNC          |20ms  |10 ms |1 ms  |10 ms|20 ms |2 ms|4 ms  |4 ms  |1 ms  |2 ms  |
+     * |                           |(opt.)|	     |(opt.)|     |(opt.)|    |(opt.)|(opt.)|(opt.)|      |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_BIT_SYNC             |20 ms |20 ms |1 ms  |20 ms|20 ms |-   |8 ms  |-     |1 ms  |4 ms  |
+     * |                           |      |      |(opt.)|     |      |    |      |      |(opt.)|      |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_SUBFRAME_SYNC        |6s    |6s    |-     |2 s  |6 s   |-   |-     |-     |100 ms|-     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_TOW_DECODED          |1 week|-     |-     |1 day|1 week|-   |1 week|-     |-     |1 week|
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_TOW_KNOWN            |1 week|-     |-     |1 day|1 week|-   |1 week|-     |-     |1 week|
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_GLO_STRING_SYNC      |-     |-     |-     |2 s  |-     |-   |-     |-     |-     |-     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_GLO_TOD_DECODED      |-     |-     |-     |1 day|-     |-   |-     |-     |-     |-     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_GLO_TOD_KNOWN        |-     |-     |-     |1 day|-     |-   |-     |-     |-     |-     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_BDS_D2_BIT_SYNC      |-     |-     |-     |-    |-     |2 ms|-     |-     |-     |-     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_BDS_D2_SUBFRAME_SYNC |-     |-     |-     |-    |-     |600 |-     |-     |-     |-     |
+     * |                           |      |      |      |     |      |ms  |      |      |      |      |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_GAL_E1BC_CODE_LOCK   |-     |-     |-     |-    |-     |-   |4 ms  |4 ms  |-     |-     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_GAL_E1C_2ND_CODE_LOCK|-     |-     |-     |-    |-     |-   |-     |100 ms|-     |-     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_2ND_CODE_LOCK        |-     |10 ms |20 ms |-    |-     |-	  |-     |100 ms|100 ms|-     |
+     * |                           |      |(opt.)|      |     |      |    |      |(opt.)|      |      |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_GAL_E1B_PAGE_SYNC    |-     |-     |-     |-    |-     |-   |2 s   |-     |-     |-     |
+     * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     * |STATE_SBAS_SYNC            |-     |-     |-     |-    |-     |-   |-     |-     |-     |1s    |
+     * +---------------------------+------+------+------+-----+------+----+------+------+------+------+
+     *
+     * Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has
+     * been determined from other sources. If TOW decoded is set then TOW Known must also be set.
+     *
+     * Note well: if there is any ambiguity in integer millisecond, STATE_MSEC_AMBIGUOUS must be
+     * set accordingly, in the 'state' field.  This value must be populated if 'state' !=
+     * STATE_UNKNOWN.
+     *
+     * Note on optional flags:
+     *   - For L1 C/A and B1I, STATE_SYMBOL_SYNC is optional since the symbol length is the
+     *     same as the bit length.
+     *   - For L5Q and E5aQ, STATE_BIT_SYNC and STATE_SYMBOL_SYNC are optional since they are
+     *     implied by STATE_CODE_LOCK.
+     *   - STATE_2ND_CODE_LOCK for L5I is optional since it is implied by STATE_SYMBOL_SYNC.
+     *   - STATE_2ND_CODE_LOCK for E1C is optional since it is implied by
+     *     STATE_GAL_E1C_2ND_CODE_LOCK.
+     *   - For E1B and E1C, STATE_SYMBOL_SYNC is optional, because it is implied by
+     *     STATE_GAL_E1BC_CODE_LOCK.
+     */
+    const int STATE_UNKNOWN                = 0;
+    const int STATE_CODE_LOCK              = 1 << 0;
+    const int STATE_BIT_SYNC               = 1 << 1;
+    const int STATE_SUBFRAME_SYNC          = 1 << 2;
+    const int STATE_TOW_DECODED            = 1 << 3;
+    const int STATE_MSEC_AMBIGUOUS         = 1 << 4;
+    const int STATE_SYMBOL_SYNC            = 1 << 5;
+    const int STATE_GLO_STRING_SYNC        = 1 << 6;
+    const int STATE_GLO_TOD_DECODED        = 1 << 7;
+    const int STATE_BDS_D2_BIT_SYNC        = 1 << 8;
+    const int STATE_BDS_D2_SUBFRAME_SYNC   = 1 << 9;
+    const int STATE_GAL_E1BC_CODE_LOCK     = 1 << 10;
+    const int STATE_GAL_E1C_2ND_CODE_LOCK  = 1 << 11;
+    const int STATE_GAL_E1B_PAGE_SYNC      = 1 << 12;
+    const int STATE_SBAS_SYNC              = 1 << 13;
+    const int STATE_TOW_KNOWN              = 1 << 14;
+    const int STATE_GLO_TOD_KNOWN          = 1 << 15;
+    const int STATE_2ND_CODE_LOCK          = 1 << 16;
+
+    /**
+     * A bitfield of flags indicating the GnssMeasurementState per satellite sync state. It
+     * represents the current sync state for the associated satellite.
+     *
+     * Based on the sync state, the 'received GNSS tow' field must be interpreted accordingly.
+     *
+     * The bit masks are defined in the constants with prefix STATE_.
+     *
+     * This value is mandatory.
+     */
+    int state;
+
+    /**
+     * The received GNSS Time-of-Week at the measurement time, in nanoseconds.
+     * For GNSS & QZSS, this is the received GNSS Time-of-Week at the
+     * measurement time, in nanoseconds. The value is relative to the
+     * beginning of the current GNSS week.
+     *
+     * Given the highest sync state that can be achieved, per each satellite,
+     * valid range for this field can be:
+     * Searching       : [ 0       ] : STATE_UNKNOWN
+     * C/A code lock   : [ 0 1ms   ] : STATE_CODE_LOCK set
+     * Bit sync        : [ 0 20ms  ] : STATE_BIT_SYNC set
+     * Subframe sync   : [ 0  6s   ] : STATE_SUBFRAME_SYNC set
+     * TOW decoded     : [ 0 1week ] : STATE_TOW_DECODED set
+     * TOW Known       : [ 0 1week ] : STATE_TOW_KNOWN set
+     *
+     * Note: TOW Known refers to the case where TOW is possibly not decoded
+     * over the air but has been determined from other sources. If TOW
+     * decoded is set then TOW Known must also be set.
+     *
+     * Note: If there is any ambiguity in integer millisecond,
+     * STATE_MSEC_AMBIGUOUS must be set accordingly, in the
+     * 'state' field.
+     *
+     * This value must be populated if 'state' != STATE_UNKNOWN.
+     *
+     * For Glonass, this is the received Glonass time of day, at the
+     * measurement time in nanoseconds.
+     *
+     * Given the highest sync state that can be achieved, per each satellite,
+     * valid range for this field can be:
+     * Searching           : [ 0       ] : STATE_UNKNOWN set
+     * C/A code lock       : [ 0   1ms ] : STATE_CODE_LOCK set
+     * Symbol sync         : [ 0  10ms ] : STATE_SYMBOL_SYNC set
+     * Bit sync            : [ 0  20ms ] : STATE_BIT_SYNC set
+     * String sync         : [ 0    2s ] : STATE_GLO_STRING_SYNC set
+     * Time of day decoded : [ 0  1day ] : STATE_GLO_TOD_DECODED set
+     * Time of day known   : [ 0  1day ] : STATE_GLO_TOD_KNOWN set
+     *
+     * Note: Time of day known refers to the case where it is possibly not
+     * decoded over the air but has been determined from other sources. If
+     * Time of day decoded is set then Time of day known must also be set.
+     *
+     * For Beidou, this is the received Beidou time of week,
+     * at the measurement time in nanoseconds.
+     *
+     * Given the highest sync state that can be achieved, per each satellite,
+     * valid range for this field can be:
+     * Searching            : [ 0       ] : STATE_UNKNOWN set.
+     * C/A code lock        : [ 0   1ms ] : STATE_CODE_LOCK set.
+     * Bit sync (D2)        : [ 0   2ms ] : STATE_BDS_D2_BIT_SYNC set.
+     * Bit sync (D1)        : [ 0  20ms ] : STATE_BIT_SYNC set.
+     * Subframe (D2)        : [ 0  0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC set.
+     * Subframe (D1)        : [ 0    6s ] : STATE_SUBFRAME_SYNC set.
+     * Time of week decoded : [ 0 1week ] : STATE_TOW_DECODED set.
+     * Time of week known   : [ 0 1week ] : STATE_TOW_KNOWN set
+     *
+     * Note: TOW Known refers to the case where TOW is possibly not decoded
+     * over the air but has been determined from other sources. If TOW
+     * decoded is set then TOW Known must also be set.
+     *
+     * For Galileo, this is the received Galileo time of week,
+     * at the measurement time in nanoseconds.
+     *
+     * E1BC code lock       : [ 0  4ms ] : STATE_GAL_E1BC_CODE_LOCK set.
+     * E1C 2nd code lock    : [ 0 100ms] : STATE_GAL_E1C_2ND_CODE_LOCK set.
+     * E1B page             : [ 0   2s ] : STATE_GAL_E1B_PAGE_SYNC set.
+     * Time of week decoded : [ 0 1week] : STATE_TOW_DECODED is set.
+     * Time of week known   : [ 0 1week] : STATE_TOW_KNOWN set
+     *
+     * Note: TOW Known refers to the case where TOW is possibly not decoded
+     * over the air but has been determined from other sources. If TOW
+     * decoded is set then TOW Known must also be set.
+     *
+     * For SBAS, this is received SBAS time, at the measurement time in
+     * nanoseconds.
+     *
+     * Given the highest sync state that can be achieved, per each satellite,
+     * valid range for this field can be:
+     * Searching    : [ 0     ] : STATE_UNKNOWN
+     * C/A code lock: [ 0 1ms ] : STATE_CODE_LOCK is set
+     * Symbol sync  : [ 0 2ms ] : STATE_SYMBOL_SYNC is set
+     * Message      : [ 0  1s ] : STATE_SBAS_SYNC is set
+     */
+    long receivedSvTimeInNs;
+
+    /**
+     * 1-Sigma uncertainty of the Received GNSS Time-of-Week in nanoseconds.
+     *
+     * This value must be populated if 'state' != STATE_UNKNOWN.
+     */
+    long receivedSvTimeUncertaintyInNs;
+
+    /**
+     * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
+     * It contains the measured C/N0 value for the signal at the antenna port.
+     *
+     * If a signal has separate components (e.g. Pilot and Data channels) and
+     * the receiver only processes one of the components, then the reported
+     * antennaCN0DbHz reflects only the component that is processed.
+     *
+     * This value is mandatory.
+     */
+    double antennaCN0DbHz;
+
+    /**
+     * Baseband Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. It contains the
+     * measured C/N0 value for the signal measured at the baseband.
+     *
+     * This is typically a few dB weaker than the value estimated for C/N0 at the antenna port,
+     * which is reported in cN0DbHz.
+     *
+     * If a signal has separate components (e.g. Pilot and Data channels) and the receiver only
+     * processes one of the components, then the reported basebandCN0DbHz reflects only the
+     * component that is processed.
+     *
+     * This value is mandatory.
+     */
+    double basebandCN0DbHz;
+
+    /**
+     * Pseudorange rate at the timestamp in m/s. The correction of a given
+     * Pseudorange Rate value includes corrections for receiver and satellite
+     * clock frequency errors. Ensure that this field is independent (see
+     * comment at top of GnssMeasurement struct.)
+     *
+     * It is mandatory to provide the 'uncorrected' 'pseudorange rate', and
+     * provide GnssClock's 'drift' field as well. When providing the
+     * uncorrected pseudorange rate, do not apply the corrections described above.)
+     *
+     * The value includes the 'pseudorange rate uncertainty' in it.
+     * A positive 'uncorrected' value indicates that the SV is moving away from
+     * the receiver.
+     *
+     * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the
+     * sign of 'doppler shift' is given by the equation:
+     *      pseudorange rate = -k * doppler shift   (where k is a constant)
+     *
+     * This must be the most accurate pseudorange rate available, based on
+     * fresh signal measurements from this channel.
+     *
+     * It is mandatory that this value be provided at typical carrier phase PRR
+     * quality (few cm/sec per second of uncertainty, or better) - when signals
+     * are sufficiently strong & stable, e.g. signals from a GNSS simulator at >=
+     * 35 dB-Hz.
+     */
+    double pseudorangeRateMps;
+
+    /**
+     * 1-Sigma uncertainty of the pseudorangeRateMps.
+     * The uncertainty is represented as an absolute (single sided) value.
+     *
+     * This value is mandatory.
+     */
+    double pseudorangeRateUncertaintyMps;
+
+
+    /**
+     * Flags indicating the Accumulated Delta Range's states.
+     *
+     * See the table below for a detailed interpretation of each state.
+     *
+     * +---------------------+-------------------+-----------------------------+
+     * | ADR_STATE           | Time of relevance | Interpretation              |
+     * +---------------------+-------------------+-----------------------------+
+     * | UNKNOWN             | ADR(t)            | No valid carrier phase      |
+     * |                     |                   | information is available    |
+     * |                     |                   | at time t.                  |
+     * +---------------------+-------------------+-----------------------------+
+     * | VALID               | ADR(t)            | Valid carrier phase         |
+     * |                     |                   | information is available    |
+     * |                     |                   | at time t. This indicates   |
+     * |                     |                   | that this measurement can   |
+     * |                     |                   | be used as a reference for  |
+     * |                     |                   | future measurements.        |
+     * |                     |                   | However, to compare it to   |
+     * |                     |                   | previous measurements to    |
+     * |                     |                   | compute delta range,        |
+     * |                     |                   | other bits should be        |
+     * |                     |                   | checked. Specifically, it   |
+     * |                     |                   | can be used for delta range |
+     * |                     |                   | computation if it is valid  |
+     * |                     |                   | and has no reset or cycle   |
+     * |                     |                   | slip at this epoch i.e.     |
+     * |                     |                   | if VALID_BIT == 1 &&        |
+     * |                     |                   | CYCLE_SLIP_BIT == 0 &&      |
+     * |                     |                   | RESET_BIT == 0.             |
+     * +---------------------+-------------------+-----------------------------+
+     * | RESET               | ADR(t) - ADR(t-1) | Carrier phase accumulation  |
+     * |                     |                   | has been restarted between  |
+     * |                     |                   | current time t and previous |
+     * |                     |                   | time t-1. This indicates    |
+     * |                     |                   | that this measurement can   |
+     * |                     |                   | be used as a reference for  |
+     * |                     |                   | future measurements, but it |
+     * |                     |                   | should not be compared to   |
+     * |                     |                   | previous measurements to    |
+     * |                     |                   | compute delta range.        |
+     * +---------------------+-------------------+-----------------------------+
+     * | CYCLE_SLIP          | ADR(t) - ADR(t-1) | Cycle slip(s) have been     |
+     * |                     |                   | detected between the        |
+     * |                     |                   | current time t and previous |
+     * |                     |                   | time t-1. This indicates    |
+     * |                     |                   | that this measurement can   |
+     * |                     |                   | be used as a reference for  |
+     * |                     |                   | future measurements.        |
+     * |                     |                   | Clients can use a           |
+     * |                     |                   | measurement with a cycle    |
+     * |                     |                   | slip to compute delta range |
+     * |                     |                   | against previous            |
+     * |                     |                   | measurements at their own   |
+     * |                     |                   | risk.                       |
+     * +---------------------+-------------------+-----------------------------+
+     * | HALF_CYCLE_RESOLVED | ADR(t)            | Half cycle ambiguity is     |
+     * |                     |                   | resolved at time t.         |
+     * +---------------------+-------------------+-----------------------------+
+     */
+    const int ADR_STATE_UNKNOWN = 0;
+    const int ADR_STATE_VALID = 1 << 0;
+    const int ADR_STATE_RESET = 1 << 1;
+    const int ADR_STATE_CYCLE_SLIP = 1 << 2;
+    const int ADR_STATE_HALF_CYCLE_RESOLVED = 1 << 3;
+
+    /**
+     * A bitfield of flags indicating the accumulated delta range's state. It indicates whether ADR
+     * is reset or there is a cycle slip(indicating loss of lock).
+     *
+     * The bit masks are defined in constants with prefix ADR_STATE_.
+     *
+     * This value is mandatory.
+     */
+    int accumulatedDeltaRangeState;
+
+    /**
+     * Accumulated delta range since the last channel reset in meters.
+     * A positive value indicates that the SV is moving away from the receiver.
+     *
+     * The sign of the 'accumulated delta range' and its relation to the sign of
+     * 'carrier phase' is given by the equation:
+     * accumulated delta range = -k * carrier phase (where k is a constant)
+     *
+     * This value must be populated if 'accumulated delta range state' !=
+     * ADR_STATE_UNKNOWN.
+     * However, it is expected that the data is only accurate when:
+     *      'accumulated delta range state' == ADR_STATE_VALID.
+     *
+     * The alignment of the phase measurement will not be  adjusted by the receiver so the in-phase
+     * and quadrature phase components will have a quarter cycle offset as they do when transmitted
+     * from the satellites. If the measurement is from a combination of the in-phase and quadrature
+     * phase components, then the alignment of the phase measurement will be aligned to the in-phase
+     * component.
+     */
+    double accumulatedDeltaRangeM;
+
+    /**
+     * 1-Sigma uncertainty of the accumulated delta range in meters.
+     * This value must be populated if 'accumulated delta range state' !=
+     * ADR_STATE_UNKNOWN.
+     */
+    double accumulatedDeltaRangeUncertaintyM;
+
+    /**
+     * Carrier frequency of the signal tracked, for example it can be the
+     * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
+     * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it
+     * is the primary common use central frequency, e.g. L1 = 1575.45 MHz
+     * for GPS.
+     *
+     * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
+     * time, two raw measurement structs must be reported for this same
+     * satellite, in one of the measurement structs, all the values related
+     * to L1 must be filled, and in the other all of the values related to
+     * L5 must be filled.
+     *
+     * If the data is available, gnssMeasurementFlags must contain
+     * HAS_CARRIER_FREQUENCY.
+     */
+    float carrierFrequencyHz;
+
+    /**
+     * The number of full carrier cycles between the satellite and the
+     * receiver. The reference frequency is given by the field
+     * 'carrierFrequencyHz'. Indications of possible cycle slips and
+     * resets in the accumulation of this value can be inferred from the
+     * accumulatedDeltaRangeState flags.
+     *
+     * If the data is available, gnssMeasurementFlags must contain
+     * HAS_CARRIER_CYCLES.
+     */
+    long carrierCycles;
+
+    /**
+     * The RF phase detected by the receiver, in the range [0.0, 1.0].
+     * This is usually the fractional part of the complete carrier phase
+     * measurement.
+     *
+     * The reference frequency is given by the field 'carrierFrequencyHz'.
+     * The value contains the 'carrier-phase uncertainty' in it.
+     *
+     * If the data is available, gnssMeasurementFlags must contain
+     * HAS_CARRIER_PHASE.
+     */
+    double carrierPhase;
+
+    /**
+     * 1-Sigma uncertainty of the carrier-phase.
+     * If the data is available, gnssMeasurementFlags must contain
+     * HAS_CARRIER_PHASE_UNCERTAINTY.
+     */
+    double carrierPhaseUncertainty;
+
+    /**
+     * An enumeration that indicates the 'multipath' state of the event.
+     *
+     * The multipath Indicator is intended to report the presence of overlapping
+     * signals that manifest as distorted correlation peaks.
+     *
+     * - if there is a distorted correlation peak shape, report that multipath
+     *   is MULTIPATH_INDICATOR_PRESENT.
+     * - if there is no distorted correlation peak shape, report
+     *   MULTIPATH_INDICATOR_NOT_PRESENT
+     * - if signals are too weak to discern this information, report
+     *   MULTIPATH_INDICATOR_UNKNOWN
+     *
+     * Example: when doing the standardized overlapping Multipath Performance
+     * test (3GPP TS 34.171) the Multipath indicator must report
+     * MULTIPATH_INDICATOR_PRESENT for those signals that are tracked, and
+     * contain multipath, and MULTIPATH_INDICATOR_NOT_PRESENT for those
+     * signals that are tracked and do not contain multipath.
+     */
+    GnssMultipathIndicator multipathIndicator;
+
+    /**
+     * Signal-to-noise ratio at correlator output in dB.
+     * If the data is available, GnssMeasurementFlags must contain HAS_SNR.
+     * This is the power ratio of the "correlation peak height above the
+     * observed noise floor" to "the noise RMS".
+     */
+    double snrDb;
+
+    /**
+     * Automatic gain control (AGC) level. AGC acts as a variable gain
+     * amplifier adjusting the power of the incoming signal. The AGC level
+     * may be used to indicate potential interference. When AGC is at a
+     * nominal level, this value must be set as 0. Higher gain (and/or lower
+     * input power) must be output as a positive number. Hence in cases of
+     * strong jamming, in the band of this signal, this value must go more
+     * negative.
+     *
+     * Note: Different hardware designs (e.g. antenna, pre-amplification, or
+     * other RF HW components) may also affect the typical output of this
+     * value on any given hardware design in an open sky test - the
+     * important aspect of this output is that changes in this value are
+     * indicative of changes on input signal power in the frequency band for
+     * this measurement.
+     */
+    double agcLevelDb;
+
+    /**
+     * The full inter-signal bias (ISB) in nanoseconds.
+     *
+     * This value is the sum of the estimated receiver-side and the space-segment-side inter-system
+     * bias, inter-frequency bias and inter-code bias, including
+     *
+     * - Receiver inter-constellation bias (with respect to the constellation in
+     *   GnssClock.referenceSignalTypeForIsb)
+     * - Receiver inter-frequency bias (with respect to the carrier frequency in
+     *   GnssClock.referenceSignalTypeForIsb)
+     * - Receiver inter-code bias (with respect to the code type in
+     *   GnssClock.referenceSignalTypeForIsb)
+     * - Master clock bias (e.g., GPS-GAL Time Offset (GGTO), GPS-UTC Time Offset (TauGps), BDS-GLO
+     *   Time Offset (BGTO)) (with respect to the constellation in
+     *   GnssClock.referenceSignalTypeForIsb)
+     * - Group delay (e.g., Total Group Delay (TGD))
+     * - Satellite inter-frequency bias (GLO only) (with respect to the carrier frequency in
+     *   GnssClock.referenceSignalTypeForIsb)
+     * - Satellite inter-code bias (e.g., Differential Code Bias (DCB)) (with respect to the code
+     *   type in GnssClock.referenceSignalTypeForIsb)
+     *
+     * If a component of the above is already compensated in the provided
+     * GnssMeasurement.receivedSvTimeInNs, then it must not be included in the reported full ISB.
+     *
+     * The value does not include the inter-frequency Ionospheric bias.
+     *
+     * The full ISB of GnssClock.referenceSignalTypeForIsb is defined to be 0.0 nanoseconds.
+     */
+    double fullInterSignalBiasNs;
+
+    /**
+     * 1-sigma uncertainty associated with the full inter-signal bias in nanoseconds.
+     */
+    double fullInterSignalBiasUncertaintyNs;
+
+    /**
+     * The satellite inter-signal bias in nanoseconds.
+     *
+     * This value is the sum of the space-segment-side inter-system bias, inter-frequency bias
+     * and inter-code bias, including
+     *
+     * - Master clock bias (e.g., GPS-GAL Time Offset (GGTO), GPS-UTC Time Offset (TauGps), BDS-GLO
+     *   Time Offset (BGTO)) (with respect to the constellation in
+     *   GnssClock.referenceSignalTypeForIsb)
+     * - Group delay (e.g., Total Group Delay (TGD))
+     * - Satellite inter-frequency bias (GLO only) (with respect to the carrier frequency in
+     *   GnssClock.referenceSignalTypeForIsb)
+     * - Satellite inter-code bias (e.g., Differential Code Bias (DCB)) (with respect to the code
+     *   type in GnssClock.referenceSignalTypeForIsb)
+     *
+     * The satellite ISB of GnssClock.referenceSignalTypeForIsb is defined to be 0.0 nanoseconds.
+     */
+    double satelliteInterSignalBiasNs;
+
+    /**
+     * 1-sigma uncertainty associated with the satellite inter-signal bias in nanoseconds.
+     */
+    double satelliteInterSignalBiasUncertaintyNs;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl b/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl
new file mode 100644
index 0000000..ec1ce62
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+/**
+ * Enumeration of available values for the GNSS Measurement's multipath
+ * indicator.
+ */
+@VintfStability
+@Backing(type="int")
+enum GnssMultipathIndicator {
+    /** The indicator is not available or unknown. */
+    UNKNOWN      = 0,
+    /** The measurement is indicated to be affected by multipath. */
+    PRESENT      = 1,
+    /** The measurement is indicated to be not affected by multipath. */
+    NOT_PRESENT = 2,
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
new file mode 100644
index 0000000..a284fed
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
@@ -0,0 +1,149 @@
+/*
+ * 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.GnssConstellationType;
+
+/**
+ * Represents a GNSS signal type.
+ */
+@VintfStability
+parcelable GnssSignalType {
+    /**
+     * Constellation type of the SV that transmits the signal.
+     */
+    GnssConstellationType constellation;
+
+    /**
+     * Carrier frequency of the signal tracked, for example it can be the
+     * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
+     * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it
+     * is the primary common use central frequency, e.g. L1 = 1575.45 MHz
+     * for GPS.
+     *
+     * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
+     * time, two raw measurement structs must be reported for this same
+     * satellite, in one of the measurement structs, all the values related
+     * to L1 must be filled, and in the other all of the values related to
+     * L5 must be filled.
+     */
+    double carrierFrequencyHz;
+
+    /**
+     * GNSS signal code type "A" representing GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA.
+     */
+    const String CODE_TYPE_A = "A";
+
+    /**
+     * GNSS signal code type "B" representing GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB.
+     */
+    const String CODE_TYPE_B = "B";
+
+    /**
+     * GNSS signal code type "C" representing GPS L1 C/A,  GPS L2 C/A, GLONASS G1 C/A,
+     * GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS L1 C/A, QZSS L1 C/A, IRNSS L5C.
+     */
+    const String CODE_TYPE_C = "C";
+
+    /**
+     * GNSS signal code type "D" representing BDS B1C D.
+     */
+    const String CODE_TYPE_D = "D";
+
+    /**
+     * GNSS signal code type "I" representing GPS L5 I, GLONASS G3 I, GALILEO E5a I, GALILEO E5b I,
+     * GALILEO E5a+b I, SBAS L5 I, QZSS L5 I, BDS B1 I, BDS B2 I, BDS B3 I.
+     */
+    const String CODE_TYPE_I = "I";
+
+    /**
+     * GNSS signal code type "L" representing GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L),
+     * LEX(6) L.
+     */
+    const String CODE_TYPE_L = "L";
+
+    /**
+     * GNSS signal code type "M" representing GPS L1M, GPS L2M.
+     */
+    const String CODE_TYPE_M = "M";
+
+    /**
+     * GNSS signal code type "N" representing GPS L1 codeless, GPS L2 codeless.
+     */
+    const String CODE_TYPE_N = "N";
+
+    /**
+     * GNSS signal code type "P" representing GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P, BDS B1C P.
+     */
+    const String CODE_TYPE_P = "P";
+
+    /**
+     * GNSS signal code type "Q" representing GPS L5 Q, GLONASS G3 Q, GALILEO E5a Q, GALILEO E5b Q,
+     * GALILEO E5a+b Q, SBAS L5 Q, QZSS L5 Q, BDS B1 Q, BDS B2 Q, BDS B3 Q.
+     */
+    const String CODE_TYPE_Q = "Q";
+
+    /**
+     * GNSS signal code type "S" represents GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M),
+     * LEX(6) S.
+     */
+    const String CODE_TYPE_S = "S";
+
+    /**
+     * GNSS signal code type "W" representing GPS L1 Z-tracking, GPS L2 Z-tracking.
+     */
+    const String CODE_TYPE_W = "W";
+
+    /**
+     * GNSS signal code type "X" representing GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q),
+     * GLONASS G3 (I+Q), GALILEO E1 (B+C), GALILEO E5a (I+Q), GALILEO E5b (I+Q), GALILEO E5a+b(I+Q),
+     * GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q),
+     * LEX(6) (S+L), BDS B1 (I+Q), BDS B1C (D+P), BDS B2 (I+Q), BDS B3 (I+Q), IRNSS L5 (B+C).
+     */
+    const String CODE_TYPE_X = "X";
+
+    /**
+     * GNSS signal code type "Y" representing GPS L1Y, GPS L2Y.
+     */
+    const String CODE_TYPE_Y = "Y";
+
+    /**
+     * GNSS signal code type "Z" representing GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF.
+     */
+    const String CODE_TYPE_Z = "Z";
+
+    /**
+     * GNSS signal code type "UNKNOWN" representing the GNSS Measurement's code type is unknown.
+     */
+    const String CODE_TYPE_UNKNOWN = "UNKNOWN";
+
+    /**
+     * The type of code that is currently being tracked in the GNSS signal.
+     *
+     * For high precision applications the type of code being tracked needs to be considered
+     * in-order to properly apply code specific corrections to the pseudorange measurements.
+     *
+     * The value is one of the constant Strings with prefix CODE_TYPE_ defined in this parcelable.
+     *
+     * This is used to specify the observation descriptor defined in GNSS Observation Data File
+     * Header Section Description in the RINEX standard (Version 3.XX). In RINEX Version 3.03,
+     * in Appendix Table A2 Attributes are listed as uppercase letters (for instance, "A" for
+     * "A channel"). In the future, if for instance a code "G" was added in the official RINEX
+     * standard, "G" could be specified here.
+     */
+    String codeType;
+}
diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl
index 2af57b5..c815e2d 100644
--- a/gnss/aidl/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl
@@ -17,9 +17,10 @@
 package android.hardware.gnss;
 
 import android.hardware.gnss.IGnssCallback;
+import android.hardware.gnss.IGnssConfiguration;
+import android.hardware.gnss.IGnssMeasurementInterface;
 import android.hardware.gnss.IGnssPowerIndication;
 import android.hardware.gnss.IGnssPsds;
-import android.hardware.gnss.IGnssConfiguration;
 
 /**
  * Represents the standard GNSS (Global Navigation Satellite System) interface.
@@ -33,14 +34,6 @@
      */
     const int ERROR_INVALID_ARGUMENT = 1;
 
-    /** Bit mask indicating a valid timestampNs is stored in the ElapsedRealtime parcelable. */
-    const int ELAPSED_REALTIME_HAS_TIMESTAMP_NS = 1 << 0;
-
-    /**
-     * Bit mask indicating a valid timeUncertaintyNs is stored in the ElapsedRealtime parcelable.
-     */
-    const int ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS = 1 << 1;
-
     /**
      * Opens the interface and provides the callback routines to the implementation of this
      * interface.
@@ -74,6 +67,8 @@
     /**
      * This method returns the IGnssPsds interface.
      *
+     * This method must return non-null.
+     *
      * @return Handle to the IGnssPsds interface.
      */
     IGnssPsds getExtensionPsds();
@@ -81,13 +76,26 @@
     /**
      * This method returns the IGnssConfiguration interface.
      *
+     * This method must return non-null.
+     *
      * @return Handle to the IGnssConfiguration interface.
      */
     IGnssConfiguration getExtensionGnssConfiguration();
 
     /**
+     * This methods returns the IGnssMeasurementInterface interface.
+     *
+     * This method must return non-null.
+     *
+     * @return Handle to the IGnssMeasurementInterface interface.
+     */
+    IGnssMeasurementInterface getExtensionGnssMeasurement();
+
+    /**
      * This method returns the IGnssPowerIndication interface.
      *
+     * This method must return non-null.
+     *
      * @return Handle to the IGnssPowerIndication interface.
      */
     IGnssPowerIndication getExtensionGnssPowerIndication();
diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl
new file mode 100644
index 0000000..328cf2a
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl
@@ -0,0 +1,32 @@
+/*
+ * 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.GnssData;
+
+/**
+ * The callback interface to report GNSS Measurement from the HAL.
+ */
+@VintfStability
+interface IGnssMeasurementCallback {
+    /**
+     * Callback for the hal to pass a GnssData structure back to the client.
+     *
+     * @param data Contains a reading of GNSS measurements.
+     */
+    void gnssMeasurementCb(in GnssData data);
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
new file mode 100644
index 0000000..fdeebde
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
@@ -0,0 +1,55 @@
+/*
+ * 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.IGnssMeasurementCallback;
+
+/**
+ * Extended interface for GNSS Measurement support.
+ */
+@VintfStability
+interface IGnssMeasurementInterface {
+    /**
+     * Initializes the interface and registers the callback routines with the HAL. After a
+     * successful call to 'setCallback' the HAL must begin to provide updates at an average
+     * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec
+     * can be tolerated.)
+     *
+     * @param callback Handle to GnssMeasurement callback interface.
+     * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode
+     *     no clock discontinuities are expected and, when supported, carrier phase should be
+     *     continuous in good signal conditions. All non-blocklisted, healthy constellations,
+     *     satellites and frequency bands that the chipset supports must be reported in this mode.
+     *     The GNSS chipset is allowed to consume more power in this mode. If false, API must
+     *     optimize power via duty cycling, constellations and frequency limits, etc.
+     *
+     * @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has
+     *     already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC
+     *     for any other error. The HAL must not generate any other updates upon returning this
+     *     error code.
+     */
+    void setCallback(in IGnssMeasurementCallback callback, in boolean enableFullTracking);
+
+    /**
+     * Stops updates from the HAL, and unregisters the callback routines. After a call to close(),
+     * the previously registered callbacks must be considered invalid by the HAL.
+     *
+     * If close() is invoked without a previous setCallback, this function must perform
+     * no work.
+     */
+    void close();
+}
\ No newline at end of file
diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp
index 23677ed..6694ce6 100644
--- a/gnss/aidl/default/Android.bp
+++ b/gnss/aidl/default/Android.bp
@@ -50,6 +50,7 @@
         "GnssPowerIndication.cpp",
         "GnssPsds.cpp",
         "GnssConfiguration.cpp",
+        "GnssMeasurementInterface.cpp",
         "service.cpp",
     ],
     static_libs: [
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 669372b..02bad60 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -19,6 +19,7 @@
 #include "Gnss.h"
 #include <log/log.h>
 #include "GnssConfiguration.h"
+#include "GnssMeasurementInterface.h"
 #include "GnssPowerIndication.h"
 #include "GnssPsds.h"
 
@@ -74,4 +75,12 @@
     return ndk::ScopedAStatus::ok();
 }
 
+ndk::ScopedAStatus Gnss::getExtensionGnssMeasurement(
+        std::shared_ptr<IGnssMeasurementInterface>* iGnssMeasurement) {
+    ALOGD("Gnss::getExtensionGnssMeasurement");
+
+    *iGnssMeasurement = SharedRefBase::make<GnssMeasurementInterface>();
+    return ndk::ScopedAStatus::ok();
+}
+
 }  // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index 9f6ef0e..bccc7f2 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -18,6 +18,7 @@
 
 #include <aidl/android/hardware/gnss/BnGnss.h>
 #include <aidl/android/hardware/gnss/BnGnssConfiguration.h>
+#include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
 #include <aidl/android/hardware/gnss/BnGnssPowerIndication.h>
 #include <aidl/android/hardware/gnss/BnGnssPsds.h>
 #include "GnssConfiguration.h"
@@ -33,6 +34,8 @@
             std::shared_ptr<IGnssConfiguration>* iGnssConfiguration) override;
     ndk::ScopedAStatus getExtensionGnssPowerIndication(
             std::shared_ptr<IGnssPowerIndication>* iGnssPowerIndication) override;
+    ndk::ScopedAStatus getExtensionGnssMeasurement(
+            std::shared_ptr<IGnssMeasurementInterface>* iGnssMeasurement) override;
 
     std::shared_ptr<GnssConfiguration> mGnssConfiguration;
 
diff --git a/gnss/aidl/default/GnssConfiguration.h b/gnss/aidl/default/GnssConfiguration.h
index 25fa16e..491733c 100644
--- a/gnss/aidl/default/GnssConfiguration.h
+++ b/gnss/aidl/default/GnssConfiguration.h
@@ -24,8 +24,6 @@
 
 namespace aidl::android::hardware::gnss {
 
-using android::hardware::gnss::GnssConstellationType;
-
 struct BlocklistedSourceHash {
     inline int operator()(const BlocklistedSource& source) const {
         return int(source.constellation) * 1000 + int(source.svid);
@@ -42,7 +40,8 @@
 using std::vector;
 using BlocklistedSourceSet =
         std::unordered_set<BlocklistedSource, BlocklistedSourceHash, BlocklistedSourceEqual>;
-using BlocklistedConstellationSet = std::unordered_set<GnssConstellationType>;
+using BlocklistedConstellationSet =
+        std::unordered_set<android::hardware::gnss::GnssConstellationType>;
 
 struct GnssConfiguration : public BnGnssConfiguration {
   public:
diff --git a/gnss/aidl/default/GnssHidlHal.cpp b/gnss/aidl/default/GnssHidlHal.cpp
index 11fc806..9529ec9 100644
--- a/gnss/aidl/default/GnssHidlHal.cpp
+++ b/gnss/aidl/default/GnssHidlHal.cpp
@@ -17,11 +17,10 @@
 #define LOG_TAG "GnssHidlHal"
 
 #include "GnssHidlHal.h"
-//#include <android/hardware/gnss/1.0/IGnssCallback.h>
 
 namespace aidl::android::hardware::gnss {
 
-namespace V1_0 = ::android::hardware::gnss::V1_0;
+using GnssSvInfo = ::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo;
 
 GnssHidlHal::GnssHidlHal(const std::shared_ptr<Gnss>& gnssAidl) : mGnssAidl(gnssAidl) {
     Gnss* iGnss = mGnssAidl.get();
@@ -45,8 +44,8 @@
         if (mGnssConfigurationAidl->isBlocklistedV2_1(gnssSvInfoList[i])) {
             ALOGD("Blocklisted constellation: %d, svid: %d",
                   (int)gnssSvInfoList[i].v2_0.constellation, gnssSvInfoList[i].v2_0.v1_0.svid);
-            gnssSvInfoList[i].v2_0.v1_0.svFlag &=
-                    ~static_cast<uint8_t>(V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX);
+            gnssSvInfoList[i].v2_0.v1_0.svFlag &= ~static_cast<uint8_t>(
+                    ::android::hardware::gnss::V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX);
         }
     }
     return gnssSvInfoList;
diff --git a/gnss/aidl/default/GnssHidlHal.h b/gnss/aidl/default/GnssHidlHal.h
index 50aad3a..93a79a1 100644
--- a/gnss/aidl/default/GnssHidlHal.h
+++ b/gnss/aidl/default/GnssHidlHal.h
@@ -22,16 +22,16 @@
 
 namespace aidl::android::hardware::gnss {
 
-using ::android::hardware::gnss::common::implementation::GnssTemplate;
-using GnssSvInfo = ::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo;
-
-class GnssHidlHal : public GnssTemplate<::android::hardware::gnss::V2_1::IGnss> {
+class GnssHidlHal : public ::android::hardware::gnss::common::implementation::GnssTemplate<
+                            ::android::hardware::gnss::V2_1::IGnss> {
   public:
     GnssHidlHal(const std::shared_ptr<Gnss>& gnssAidl);
 
   private:
-    hidl_vec<GnssSvInfo> filterBlocklistedSatellitesV2_1(
-            hidl_vec<GnssSvInfo> gnssSvInfoList) override;
+    hidl_vec<::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo>
+    filterBlocklistedSatellitesV2_1(
+            hidl_vec<::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo> gnssSvInfoList)
+            override;
 
     std::shared_ptr<Gnss> mGnssAidl;
     std::shared_ptr<GnssConfiguration> mGnssConfigurationAidl;
diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp
new file mode 100644
index 0000000..d726d95
--- /dev/null
+++ b/gnss/aidl/default/GnssMeasurementInterface.cpp
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "GnssMeasIfaceAidl"
+
+#include "GnssMeasurementInterface.h"
+#include <aidl/android/hardware/gnss/BnGnss.h>
+#include <log/log.h>
+#include "Utils.h"
+
+namespace aidl::android::hardware::gnss {
+
+using Utils = ::android::hardware::gnss::common::Utils;
+
+std::shared_ptr<IGnssMeasurementCallback> GnssMeasurementInterface::sCallback = nullptr;
+
+GnssMeasurementInterface::GnssMeasurementInterface() : mMinIntervalMillis(1000) {}
+
+GnssMeasurementInterface::~GnssMeasurementInterface() {
+    stop();
+}
+
+ndk::ScopedAStatus GnssMeasurementInterface::setCallback(
+        const std::shared_ptr<IGnssMeasurementCallback>& callback, const bool enableFullTracking) {
+    ALOGD("setCallback: enableFullTracking: %d", (int)enableFullTracking);
+    std::unique_lock<std::mutex> lock(mMutex);
+    sCallback = callback;
+
+    if (mIsActive) {
+        ALOGW("GnssMeasurement callback already set. Resetting the callback...");
+        stop();
+    }
+    start();
+
+    return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus GnssMeasurementInterface::close() {
+    ALOGD("close");
+    stop();
+    std::unique_lock<std::mutex> lock(mMutex);
+    sCallback = nullptr;
+    return ndk::ScopedAStatus::ok();
+}
+
+void GnssMeasurementInterface::start() {
+    ALOGD("start");
+    mIsActive = true;
+    mThread = std::thread([this]() {
+        while (mIsActive == true) {
+            auto measurement = Utils::getMockMeasurement();
+            this->reportMeasurement(measurement);
+
+            std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMillis));
+        }
+    });
+}
+
+void GnssMeasurementInterface::stop() {
+    ALOGD("stop");
+    mIsActive = false;
+    if (mThread.joinable()) {
+        mThread.join();
+    }
+}
+
+void GnssMeasurementInterface::reportMeasurement(const GnssData& data) {
+    ALOGD("reportMeasurement()");
+    std::unique_lock<std::mutex> lock(mMutex);
+    if (sCallback == nullptr) {
+        ALOGE("%s: GnssMeasurement::sCallback is null.", __func__);
+        return;
+    }
+    sCallback->gnssMeasurementCb(data);
+}
+
+}  // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h
new file mode 100644
index 0000000..69cd871
--- /dev/null
+++ b/gnss/aidl/default/GnssMeasurementInterface.h
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/gnss/BnGnssMeasurementCallback.h>
+#include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
+#include <atomic>
+#include <mutex>
+#include <thread>
+
+namespace aidl::android::hardware::gnss {
+
+struct GnssMeasurementInterface : public BnGnssMeasurementInterface {
+  public:
+    GnssMeasurementInterface();
+    ~GnssMeasurementInterface();
+    ndk::ScopedAStatus setCallback(const std::shared_ptr<IGnssMeasurementCallback>& callback,
+                                   const bool enableFullTracking) override;
+    ndk::ScopedAStatus close() override;
+
+  private:
+    void start();
+    void stop();
+    void reportMeasurement(const GnssData&);
+
+    std::atomic<long> mMinIntervalMillis;
+    std::atomic<bool> mIsActive;
+    std::thread mThread;
+
+    // Guarded by mMutex
+    static std::shared_ptr<IGnssMeasurementCallback> sCallback;
+
+    // Synchronization lock for sCallback
+    mutable std::mutex mMutex;
+};
+
+}  // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssPowerIndication.cpp b/gnss/aidl/default/GnssPowerIndication.cpp
index 8ea60f3..429cc8c 100644
--- a/gnss/aidl/default/GnssPowerIndication.cpp
+++ b/gnss/aidl/default/GnssPowerIndication.cpp
@@ -19,6 +19,7 @@
 #include "GnssPowerIndication.h"
 #include <aidl/android/hardware/gnss/BnGnss.h>
 #include <log/log.h>
+#include <utils/SystemClock.h>
 
 namespace aidl::android::hardware::gnss {
 
@@ -43,10 +44,9 @@
     std::unique_lock<std::mutex> lock(mMutex);
 
     ElapsedRealtime elapsedRealtime = {
-            .flags = IGnss::ELAPSED_REALTIME_HAS_TIMESTAMP_NS |
-                     IGnss::ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS,
-            .timestampNs = (long)1323542,
-            .timeUncertaintyNs = (long)1000,
+            .flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS,
+            .timestampNs = ::android::elapsedRealtimeNano(),
+            .timeUncertaintyNs = 1000,
     };
     GnssPowerStats gnssPowerStats = {
             .elapsedRealtime = elapsedRealtime,
diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp
index d102e7f..c10e809 100644
--- a/gnss/aidl/vts/Android.bp
+++ b/gnss/aidl/vts/Android.bp
@@ -22,6 +22,7 @@
         "gnss_hal_test.cpp",
         "gnss_hal_test_cases.cpp",
         "GnssCallbackAidl.cpp",
+        "GnssMeasurementCallbackAidl.cpp",
         "GnssPowerIndicationCallback.cpp",
         "VtsHalGnssTargetTest.cpp",
     ],
diff --git a/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp
new file mode 100644
index 0000000..c4fad7f
--- /dev/null
+++ b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "GnssMeasurementCallbackAidl"
+
+#include "GnssMeasurementCallbackAidl.h"
+#include <inttypes.h>
+#include <log/log.h>
+
+using android::hardware::gnss::GnssData;
+
+android::binder::Status GnssMeasurementCallbackAidl::gnssMeasurementCb(const GnssData& gnssData) {
+    ALOGI("gnssMeasurementCb");
+    ALOGI("elapsedRealtime: flags = %d, timestampNs: %" PRId64 ", timeUncertaintyNs=%lf",
+          gnssData.elapsedRealtime.flags, gnssData.elapsedRealtime.timestampNs,
+          gnssData.elapsedRealtime.timeUncertaintyNs);
+    for (const auto& measurement : gnssData.measurements) {
+        ALOGI("measurement.receivedSvTimeInNs=%" PRId64, measurement.receivedSvTimeInNs);
+    }
+    gnss_data_cbq_.store(gnssData);
+    return android::binder::Status::ok();
+}
diff --git a/gnss/aidl/vts/GnssMeasurementCallbackAidl.h b/gnss/aidl/vts/GnssMeasurementCallbackAidl.h
new file mode 100644
index 0000000..f6c79cf
--- /dev/null
+++ b/gnss/aidl/vts/GnssMeasurementCallbackAidl.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <android/hardware/gnss/BnGnssMeasurementCallback.h>
+#include "GnssCallbackEventQueue.h"
+
+/** Implementation for IGnssMeasurementCallback. */
+class GnssMeasurementCallbackAidl : public android::hardware::gnss::BnGnssMeasurementCallback {
+  public:
+    GnssMeasurementCallbackAidl() : gnss_data_cbq_("gnss_data") {}
+    ~GnssMeasurementCallbackAidl() {}
+
+    android::binder::Status gnssMeasurementCb(
+            const android::hardware::gnss::GnssData& gnssData) override;
+
+    android::hardware::gnss::common::GnssCallbackEventQueue<android::hardware::gnss::GnssData>
+            gnss_data_cbq_;
+};
diff --git a/gnss/aidl/vts/GnssPowerIndicationCallback.h b/gnss/aidl/vts/GnssPowerIndicationCallback.h
index d4c4539..3416f17 100644
--- a/gnss/aidl/vts/GnssPowerIndicationCallback.h
+++ b/gnss/aidl/vts/GnssPowerIndicationCallback.h
@@ -25,7 +25,6 @@
   public:
     GnssPowerIndicationCallback()
         : capabilities_cbq_("capabilities"),
-          other_mode_names_cbq_("other_mode_names"),
           gnss_power_stats_cbq_("gnss_power_stats") {}
     ~GnssPowerIndicationCallback() {}
 
@@ -35,9 +34,6 @@
 
     android::hardware::gnss::common::GnssCallbackEventQueue<int> capabilities_cbq_;
     int last_capabilities_;
-    android::hardware::gnss::common::GnssCallbackEventQueue<std::vector<std::string>>
-            other_mode_names_cbq_;
-    std::vector<std::string> last_other_mode_names_;
     android::hardware::gnss::common::GnssCallbackEventQueue<android::hardware::gnss::GnssPowerStats>
             gnss_power_stats_cbq_;
     android::hardware::gnss::GnssPowerStats last_gnss_power_stats_;
diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h
index eb5301e..f72f7fe 100644
--- a/gnss/aidl/vts/gnss_hal_test.h
+++ b/gnss/aidl/vts/gnss_hal_test.h
@@ -36,7 +36,7 @@
 using android::hardware::gnss::IGnssConfiguration;
 
 // The main test class for GNSS HAL.
-class GnssHalTest : public GnssHalTestTemplate<IGnss_V2_1> {
+class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate<IGnss_V2_1> {
   public:
     GnssHalTest(){};
     ~GnssHalTest(){};
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 4e8d0bd..857c742 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -16,19 +16,30 @@
 
 #define LOG_TAG "GnssHalTestCases"
 
+#include <android/hardware/gnss/IGnss.h>
+#include <android/hardware/gnss/IGnssMeasurementCallback.h>
+#include <android/hardware/gnss/IGnssMeasurementInterface.h>
 #include <android/hardware/gnss/IGnssPowerIndication.h>
 #include <android/hardware/gnss/IGnssPsds.h>
+#include "GnssMeasurementCallbackAidl.h"
 #include "GnssPowerIndicationCallback.h"
 #include "gnss_hal_test.h"
 
 using android::sp;
 using android::hardware::gnss::BlocklistedSource;
-using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
+using android::hardware::gnss::ElapsedRealtime;
+using android::hardware::gnss::GnssClock;
+using android::hardware::gnss::GnssMeasurement;
+using android::hardware::gnss::IGnss;
 using android::hardware::gnss::IGnssConfiguration;
+using android::hardware::gnss::IGnssMeasurementCallback;
+using android::hardware::gnss::IGnssMeasurementInterface;
 using android::hardware::gnss::IGnssPowerIndication;
 using android::hardware::gnss::IGnssPsds;
 using android::hardware::gnss::PsdsType;
 
+using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
+
 /*
  * SetupTeardownCreateCleanup:
  * Requests the gnss HAL then calls cleanup
@@ -53,6 +64,62 @@
 }
 
 /*
+ * TestGnssMeasurementExtension:
+ * 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension.
+ * 2. Sets a GnssMeasurementCallback, waits for a measurement, and verifies fields are valid.
+ */
+TEST_P(GnssHalTest, TestGnssMeasurementExtension) {
+    const int kFirstGnssMeasurementTimeoutSeconds = 10;
+    sp<IGnssMeasurementInterface> iGnssMeasurement;
+    auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
+    ASSERT_TRUE(status.isOk());
+    ASSERT_TRUE(iGnssMeasurement != nullptr);
+
+    auto callback = sp<GnssMeasurementCallbackAidl>::make();
+    status = iGnssMeasurement->setCallback(callback, /* enableFullTracking= */ true);
+    ASSERT_TRUE(status.isOk());
+
+    android::hardware::gnss::GnssData lastMeasurement;
+    ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastMeasurement,
+                                                  kFirstGnssMeasurementTimeoutSeconds));
+    EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), 1);
+    ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
+
+    // Validity check GnssData fields
+    ASSERT_TRUE(
+            lastMeasurement.elapsedRealtime.flags >= 0 &&
+            lastMeasurement.elapsedRealtime.flags <=
+                    (ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS));
+    if (lastMeasurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) {
+        ASSERT_TRUE(lastMeasurement.elapsedRealtime.timestampNs > 0);
+    }
+    if (lastMeasurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) {
+        ASSERT_TRUE(lastMeasurement.elapsedRealtime.timeUncertaintyNs > 0);
+    }
+    ASSERT_TRUE(lastMeasurement.clock.gnssClockFlags >= 0 &&
+                lastMeasurement.clock.gnssClockFlags <=
+                        (GnssClock::HAS_LEAP_SECOND | GnssClock::HAS_TIME_UNCERTAINTY |
+                         GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS |
+                         GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT |
+                         GnssClock::HAS_DRIFT_UNCERTAINTY));
+    for (const auto& measurement : lastMeasurement.measurements) {
+        ASSERT_TRUE(
+                measurement.flags >= 0 &&
+                measurement.flags <=
+                        (GnssMeasurement::HAS_SNR | GnssMeasurement::HAS_CARRIER_FREQUENCY |
+                         GnssMeasurement::HAS_CARRIER_CYCLES | GnssMeasurement::HAS_CARRIER_PHASE |
+                         GnssMeasurement::HAS_CARRIER_PHASE_UNCERTAINTY |
+                         GnssMeasurement::HAS_AUTOMATIC_GAIN_CONTROL |
+                         GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY |
+                         GnssMeasurement::HAS_SATELLITE_ISB |
+                         GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY));
+    }
+
+    status = iGnssMeasurement->close();
+    ASSERT_TRUE(status.isOk());
+}
+
+/*
  * TestGnssPowerIndication
  * 1. Gets the GnssPowerIndicationExtension.
  * 2. Sets a GnssPowerIndicationCallback.