Add GNSS HAL v2.0

- Add GnssMeasurementCodeType in IGnssMeasurementCallback.
- Add VTS tests.
- Add default implementation.

Bug: 112260995
Change-Id: Ie319cc793e9b23e86d672c826c4f5fd6a0f90d04
Fixes: 112260995
Test: atest VtsHalGnssV2_0TargetTest
diff --git a/gnss/2.0/IGnssMeasurementCallback.hal b/gnss/2.0/IGnssMeasurementCallback.hal
new file mode 100644
index 0000000..226934e
--- /dev/null
+++ b/gnss/2.0/IGnssMeasurementCallback.hal
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2018 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@2.0;
+
+import @1.0::IGnssMeasurementCallback;
+import @1.1::IGnssMeasurementCallback;
+
+/** The callback interface to report measurements from the HAL. */
+interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
+    /**
+     * Enumeration of available values for the GNSS Measurement's code type. Similar to the
+     * Attribute field described in Rinex 3.03, e.g., in Tables 4-10, and Table A2 at the Rinex 3.03
+     * Update 1 Document.
+     */
+    enum GnssMeasurementCodeType : uint8_t {
+        /** GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA. */
+        CODE_TYPE_A = 0,
+
+        /** GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB. */
+        CODE_TYPE_B = 1,
+
+        /**
+         *  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.
+         */
+        CODE_TYPE_C = 2,
+
+        /**
+         * 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.
+         */
+        CODE_TYPE_I = 3,
+
+        /** GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L), LEX(6) L. */
+        CODE_TYPE_L = 4,
+
+        /** GPS L1M, GPS L2M. */
+        CODE_TYPE_M = 5,
+
+        /** GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P. */
+        CODE_TYPE_P = 6,
+
+        /**
+         * 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.
+         */
+        CODE_TYPE_Q = 7,
+
+        /** GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M), LEX(6) S. */
+        CODE_TYPE_S = 8,
+
+        /** GPS L1 Z-tracking, GPS L2 Z-tracking. */
+        CODE_TYPE_W = 9,
+
+        /**
+         * 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 B2 (I+Q), BDS
+         * B3 (I+Q), IRNSS L5 (B+C).
+         */
+        CODE_TYPE_X = 10,
+
+        /** GPS L1Y, GPS L2Y. */
+        CODE_TYPE_Y = 11,
+
+        /** GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF. */
+        CODE_TYPE_Z = 12,
+
+        /** GPS L1 codeless, GPS L2 codeless. */
+        CODE_TYPE_CODELESS = 13
+    };
+
+    /**
+     * Extends a GNSS Measurement, adding a GnssMeasurementCodeType.
+     */
+    struct GnssMeasurement {
+        /**
+         * GNSS measurement information for a single satellite and frequency, as in the 1.1
+         * version of the HAL with further clarification of the value reported in the
+         * accumulatedDeltaRangeM field, i.e., 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.
+         */
+        @1.1::IGnssMeasurementCallback.GnssMeasurement v1_1;
+
+        /**
+         * The type of code that is currently being tracked in the GNSS measurement.
+         *
+         * For high precision applications the type of code being tracked needs to be considered
+         * in-order to properly apply code specific corrections to the psuedorange measurements.
+         */
+        GnssMeasurementCodeType codeType;
+    };
+
+    /**
+     * Complete set of GNSS Measurement data, same as 1.1 with additional enum in measurements.
+     */
+    struct GnssData {
+        /** The full set of satellite measurement observations. */
+        vec<GnssMeasurement> measurements;
+
+        /** The GNSS clock time reading. */
+        GnssClock clock;
+    };
+
+    /**
+     * Callback for the hal to pass a GnssData structure back to the client.
+     *
+     * @param data Contains a reading of GNSS measurements.
+     */
+    gnssMeasurementCb_2_0(GnssData data);
+};