Add NavIC L1 support in GnssNavigationMessage
Bug: 302199306
Test: atest GnssNavigationMessageTest
Change-Id: I306ddf27c77899f3b61bd2ca7a2e574366597092
diff --git a/AconfigFlags.bp b/AconfigFlags.bp
index 2d164f8..383ddb3 100644
--- a/AconfigFlags.bp
+++ b/AconfigFlags.bp
@@ -17,6 +17,7 @@
":android.companion.flags-aconfig-java{.generated_srcjars}",
":android.content.pm.flags-aconfig-java{.generated_srcjars}",
":android.hardware.radio.flags-aconfig-java{.generated_srcjars}",
+ ":android.location.flags-aconfig-java{.generated_srcjars}",
":android.nfc.flags-aconfig-java{.generated_srcjars}",
":android.os.flags-aconfig-java{.generated_srcjars}",
":android.os.vibrator.flags-aconfig-java{.generated_srcjars}",
@@ -134,6 +135,21 @@
aconfig_declarations: "com.android.text.flags-aconfig",
}
+// Location
+aconfig_declarations {
+ name: "android.location.flags-aconfig",
+ package: "android.location.flags",
+ srcs: [
+ "location/java/android/location/flags/*.aconfig",
+ ],
+}
+
+java_aconfig_library {
+ name: "android.location.flags-aconfig-java",
+ aconfig_declarations: "android.location.flags-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
// NFC
aconfig_declarations {
name: "android.nfc.flags-aconfig",
diff --git a/location/api/current.txt b/location/api/current.txt
index 33effdd..0c23d8c 100644
--- a/location/api/current.txt
+++ b/location/api/current.txt
@@ -412,7 +412,9 @@
field public static final int TYPE_GPS_L1CA = 257; // 0x101
field public static final int TYPE_GPS_L2CNAV = 258; // 0x102
field public static final int TYPE_GPS_L5CNAV = 259; // 0x103
- field public static final int TYPE_IRN_L5CA = 1793; // 0x701
+ field @FlaggedApi(Flags.FLAG_GNSS_API_NAVIC_L1) public static final int TYPE_IRN_L1 = 1795; // 0x703
+ field @FlaggedApi(Flags.FLAG_GNSS_API_NAVIC_L1) public static final int TYPE_IRN_L5 = 1794; // 0x702
+ field @Deprecated public static final int TYPE_IRN_L5CA = 1793; // 0x701
field public static final int TYPE_QZS_L1CA = 1025; // 0x401
field public static final int TYPE_SBS = 513; // 0x201
field public static final int TYPE_UNKNOWN = 0; // 0x0
diff --git a/location/java/android/location/GnssNavigationMessage.java b/location/java/android/location/GnssNavigationMessage.java
index 637f905..32e636f 100644
--- a/location/java/android/location/GnssNavigationMessage.java
+++ b/location/java/android/location/GnssNavigationMessage.java
@@ -16,10 +16,12 @@
package android.location;
+import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.TestApi;
+import android.location.flags.Flags;
import android.os.Parcel;
import android.os.Parcelable;
@@ -41,7 +43,7 @@
@Retention(RetentionPolicy.SOURCE)
@IntDef({TYPE_UNKNOWN, TYPE_GPS_L1CA, TYPE_GPS_L2CNAV, TYPE_GPS_L5CNAV, TYPE_GPS_CNAV2,
TYPE_SBS, TYPE_GLO_L1CA, TYPE_QZS_L1CA, TYPE_BDS_D1, TYPE_BDS_D2, TYPE_BDS_CNAV1,
- TYPE_BDS_CNAV2, TYPE_GAL_I, TYPE_GAL_F, TYPE_IRN_L5CA})
+ TYPE_BDS_CNAV2, TYPE_GAL_I, TYPE_GAL_F, TYPE_IRN_L5CA, TYPE_IRN_L5, TYPE_IRN_L1})
public @interface GnssNavigationMessageType {}
// The following enumerations must be in sync with the values declared in gps.h
@@ -74,8 +76,18 @@
public static final int TYPE_GAL_I = 0x0601;
/** Galileo F/NAV message contained in the structure. */
public static final int TYPE_GAL_F = 0x0602;
- /** IRNSS L5 C/A message contained in the structure. */
+ /**
+ * NavIC L5 C/A message contained in the structure.
+ * @deprecated Use {@link #TYPE_IRN_L5} instead.
+ */
+ @Deprecated
public static final int TYPE_IRN_L5CA = 0x0701;
+ /** NavIC L5 message contained in the structure. */
+ @FlaggedApi(Flags.FLAG_GNSS_API_NAVIC_L1)
+ public static final int TYPE_IRN_L5 = 0x0702;
+ /** NavIC L1 message contained in the structure. */
+ @FlaggedApi(Flags.FLAG_GNSS_API_NAVIC_L1)
+ public static final int TYPE_IRN_L1 = 0x0703;
/**
* The status of the GNSS Navigation Message
@@ -254,8 +266,15 @@
case TYPE_GAL_F:
return "Galileo F";
case TYPE_IRN_L5CA:
- return "IRNSS L5 C/A";
+ return "NavIC L5 C/A";
default:
+ if (Flags.gnssApiNavicL1()) {
+ if (mType == TYPE_IRN_L5) {
+ return "NavIC L5";
+ } else if (mType == TYPE_IRN_L1) {
+ return "NavIC L1";
+ }
+ }
return "<Invalid:" + mType + ">";
}
}
@@ -303,9 +322,12 @@
* navigation message, in the range of 1-25 (Subframe 1, 2, 3 does not contain a 'frame id' and
* this value can be set to -1.)</li>
* <li> For Beidou CNAV1 this refers to the page type number in the range of 1-63.</li>
- * <li> For IRNSS L5 C/A subframe 3 and 4, this value corresponds to the Message Id of the
+ * <li> For NavIC L5 subframe 3 and 4, this value corresponds to the Message Id of the
* navigation message, in the range of 1-63. (Subframe 1 and 2 does not contain a message type
* id and this value can be set to -1.)</li>
+ * <li> For NavIC L1 subframe 3, this value corresponds to the Message Id of the navigation
+ * message, in the range of 1-63. (Subframe 1 and 2 does not contain a message type id and this
+ * value can be set to -1.)</li>
* </ul>
*/
@IntRange(from = -1, to = 120)
@@ -339,8 +361,10 @@
* navigation message, in the range of 1-3.</li>
* <li> For Beidou CNAV2, the submessage id corresponds to the message type, in the range
* 1-63.</li>
- * <li> For IRNSS L5 C/A, the submessage id corresponds to the subframe number of the
- * navigation message, in the range of 1-4.</li>
+ * <li> For NavIC L5, the submessage id corresponds to the subframe number of the navigation
+ * message, in the range of 1-4.</li>
+ * <li> For NavIC L1, the submessage id corresponds to the subframe number of the navigation
+ * message, in the range of 1-3.</li>
* </ul>
*/
@IntRange(from = 1)
@@ -363,7 +387,7 @@
* <p>The bytes (or words) specified using big endian format (MSB first).
*
* <ul>
- * <li>For GPS L1 C/A, IRNSS L5 C/A, Beidou D1 & Beidou D2, each subframe contains 10
+ * <li>For GPS L1 C/A, NavIC L5, Beidou D1 & Beidou D2, each subframe contains 10
* 30-bit words. Each word (30 bits) should be fit into the last 30 bits in a 4-byte word (skip
* B31 and B32), with MSB first, for a total of 40 bytes, covering a time period of 6, 6, and
* 0.6 seconds, respectively.</li>
@@ -383,6 +407,9 @@
* 75 bytes. subframe #3 consists of 264 data bits that should be fit into 33 bytes.</li>
* <li>For Beidou CNAV2, each subframe consists of 288 data bits, that should be fit into 36
* bytes.</li>
+ * <li> For NavIC L1, subframe #1 consists of 9 data bits that should be fit into 2 bytes (skip
+ * B10-B16). subframe #2 consists of 600 bits that should be fit into 75 bytes. subframe #3
+ * consists of 274 data bits that should be fit into 35 bytes (skip B275-B280).</li>
* </ul>
*/
@NonNull
diff --git a/location/java/android/location/flags/gnss.aconfig b/location/java/android/location/flags/gnss.aconfig
new file mode 100644
index 0000000..c471a27
--- /dev/null
+++ b/location/java/android/location/flags/gnss.aconfig
@@ -0,0 +1,8 @@
+package: "android.location.flags"
+
+flag {
+ name: "gnss_api_navic_l1"
+ namespace: "location"
+ description: "Flag for GNSS API for NavIC L1"
+ bug: "302199306"
+}
\ No newline at end of file