Antenna information matrices could have diferent sizes

Support different matrices size for
PC_VARIATION_CORRECTION and SIGNAL_GAIN_CORRECTION

Bug: 168784564

Test: PASS

CRs-fixed: 2760172
Change-Id: I4abfb1551dd8f2f95803a76475667cbc97df0847
diff --git a/etc/gnss_antenna_info.conf b/etc/gnss_antenna_info.conf
index 2b5ba03..79a2aef 100644
--- a/etc/gnss_antenna_info.conf
+++ b/etc/gnss_antenna_info.conf
@@ -71,6 +71,14 @@
 # SIGNAL_GAIN_CORRECTION_UNC
 #   2D vectors of 1-sigma uncertainty in dBi associated with the signal
 #   gain correction values.
+#
+# The number of rows and columns could be the same for PC variation correction
+# and signal gain corrections, or could be different
+# If the former then NUMBER_OF_ROWS_ and NUMBER_OF_COLUMNS_ are specified once
+# only, if the latter then NUMBER_OF_ROWS_ and NUMBER_OF_COLUMNS_ represent
+# the number of rows/columns for PC variation correction and
+# NUMBER_OF_ROWS_SGC_ and NUMBER_OF_COLUMNS_SGC_ represent the number of
+# rows/columns for signal gain corrections
 
 ANTENNA_INFO_VECTOR_SIZE = 2
 
@@ -104,6 +112,8 @@
 
 NUMBER_OF_ROWS_1 = 4
 NUMBER_OF_COLUMNS_1 = 2
+NUMBER_OF_ROWS_SGC_1 = 3
+NUMBER_OF_COLUMNS_SGC_1 = 4
 
 PC_VARIATION_CORRECTION_1_ROW_0 = 55.66 77.88
 PC_VARIATION_CORRECTION_1_ROW_1 = 11.22 33.44
@@ -115,12 +125,10 @@
 PC_VARIATION_CORRECTION_UNC_1_ROW_2 = 2.1 2.2
 PC_VARIATION_CORRECTION_UNC_1_ROW_3 = 0.1 0.2
 
-SIGNAL_GAIN_CORRECTION_1_ROW_0 = 7.6 6.5
-SIGNAL_GAIN_CORRECTION_1_ROW_1 = 5.4 4.3
-SIGNAL_GAIN_CORRECTION_1_ROW_2 = 1.3 2.4
-SIGNAL_GAIN_CORRECTION_1_ROW_3 = 9.8 8.7
+SIGNAL_GAIN_CORRECTION_1_ROW_0 = 7.6 6.5 5.4 4.3
+SIGNAL_GAIN_CORRECTION_1_ROW_1 = 1.3 2.4 9.8 8.7
+SIGNAL_GAIN_CORRECTION_1_ROW_2 = 1.4 2.5 3.6 4.7
 
-SIGNAL_GAIN_CORRECTION_UNC_1_ROW_0 = 0.91 0.92
-SIGNAL_GAIN_CORRECTION_UNC_1_ROW_1 = 0.55 0.66
-SIGNAL_GAIN_CORRECTION_UNC_1_ROW_2 = 0.11 0.22
-SIGNAL_GAIN_CORRECTION_UNC_1_ROW_3 = 0.93 0.94
+SIGNAL_GAIN_CORRECTION_UNC_1_ROW_0 = 0.91 0.92 0.55 0.66
+SIGNAL_GAIN_CORRECTION_UNC_1_ROW_1 = 0.11 0.22 0.93 0.94
+SIGNAL_GAIN_CORRECTION_UNC_1_ROW_2 = 0.95 0.96 0.33 0.44
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index ba9f3ee..3d02f97 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -6127,6 +6127,8 @@
         char pcOffsetStr[LOC_MAX_PARAM_STRING];
         uint32_t numberOfRows = 0;
         uint32_t numberOfColumns = 0;
+        uint32_t numberOfRowsSGC = 0;
+        uint32_t numberOfColumnsSGC = 0;
 
         gnssAntennaInfo.phaseCenterVariationCorrectionMillimeters.clear();
         gnssAntennaInfo.phaseCenterVariationCorrectionUncertaintyMillimeters.clear();
@@ -6140,6 +6142,10 @@
         s3 += to_string(i);
         string s4 = "NUMBER_OF_COLUMNS_";
         s4 += to_string(i);
+        string s5 = "NUMBER_OF_ROWS_SGC_";
+        s5 += to_string(i);
+        string s6 = "NUMBER_OF_COLUMNS_SGC_";
+        s6 += to_string(i);
 
         gnssAntennaInfo.size = sizeof(gnssAntennaInfo);
         loc_param_s_type ant_cf_table[] =
@@ -6148,9 +6154,18 @@
             { s2.c_str(), &pcOffsetStr, NULL, 's' },
             { s3.c_str(), &numberOfRows, NULL, 'n' },
             { s4.c_str(), &numberOfColumns, NULL, 'n' },
+            { s5.c_str(), &numberOfRowsSGC, NULL, 'n' },
+            { s6.c_str(), &numberOfColumnsSGC, NULL, 'n' },
         };
         UTIL_READ_CONF(LOC_PATH_ANT_CORR, ant_cf_table);
 
+        if (0 == numberOfRowsSGC) {
+            numberOfRowsSGC = numberOfRows;
+        }
+        if (0 == numberOfColumnsSGC) {
+            numberOfColumnsSGC = numberOfColumns;
+        }
+
         gnssAntennaInfo.carrierFrequencyMHz = carrierFrequencyMHz;
 
         // now parse pcOffsetStr to get each entry
@@ -6168,24 +6183,16 @@
         for (uint32_t j = 0; j < numberOfRows; j++) {
             char pcVarCorrStr[LOC_MAX_PARAM_STRING];
             char pcVarCorrUncStr[LOC_MAX_PARAM_STRING];
-            char sigGainCorrStr[LOC_MAX_PARAM_STRING];
-            char sigGainCorrUncStr[LOC_MAX_PARAM_STRING];
 
             string s1 = "PC_VARIATION_CORRECTION_" + to_string(i) + "_ROW_";
             s1 += to_string(j);
             string s2 = "PC_VARIATION_CORRECTION_UNC_" + to_string(i) + "_ROW_";
             s2 += to_string(j);
-            string s3 = "SIGNAL_GAIN_CORRECTION_" + to_string(i) + "_ROW_";
-            s3 += to_string(j);
-            string s4 = "SIGNAL_GAIN_CORRECTION_UNC_" + to_string(i) + "_ROW_";
-            s4 += to_string(j);
 
             loc_param_s_type ant_row_table[] =
             {
                 { s1.c_str(), &pcVarCorrStr, NULL, 's' },
                 { s2.c_str(), &pcVarCorrUncStr, NULL, 's' },
-                { s3.c_str(), &sigGainCorrStr, NULL, 's' },
-                { s4.c_str(), &sigGainCorrUncStr, NULL, 's' },
             };
             UTIL_READ_CONF(LOC_PATH_ANT_CORR, ant_row_table);
 
@@ -6193,6 +6200,23 @@
                     parseDoublesString(pcVarCorrStr));
             gnssAntennaInfo.phaseCenterVariationCorrectionUncertaintyMillimeters.push_back(
                     parseDoublesString(pcVarCorrUncStr));
+        }
+        for (uint32_t j = 0; j < numberOfRowsSGC; j++) {
+            char sigGainCorrStr[LOC_MAX_PARAM_STRING];
+            char sigGainCorrUncStr[LOC_MAX_PARAM_STRING];
+
+            string s3 = "SIGNAL_GAIN_CORRECTION_" + to_string(i) + "_ROW_";
+            s3 += to_string(j);
+            string s4 = "SIGNAL_GAIN_CORRECTION_UNC_" + to_string(i) + "_ROW_";
+            s4 += to_string(j);
+
+            loc_param_s_type ant_row_table[] =
+            {
+                { s3.c_str(), &sigGainCorrStr, NULL, 's' },
+                { s4.c_str(), &sigGainCorrUncStr, NULL, 's' },
+            };
+            UTIL_READ_CONF(LOC_PATH_ANT_CORR, ant_row_table);
+
             gnssAntennaInfo.signalGainCorrectionDbi.push_back(
                     parseDoublesString(sigGainCorrStr));
             gnssAntennaInfo.signalGainCorrectionUncertaintyDbi.push_back(