[framework] Add more description to routingTable entry.
Bug: 377887955
Test: atest CtsNfcTestCases
Change-Id: I639c6e6136a453ebd732790629729e43bde5979b
diff --git a/nfc/api/system-current.txt b/nfc/api/system-current.txt
index 15814ed..95f7d09 100644
--- a/nfc/api/system-current.txt
+++ b/nfc/api/system-current.txt
@@ -120,6 +120,11 @@
@FlaggedApi("android.nfc.nfc_oem_extension") public abstract class NfcRoutingTableEntry {
method public int getNfceeId();
+ method public int getType();
+ field public static final int TYPE_AID = 0; // 0x0
+ field public static final int TYPE_PROTOCOL = 1; // 0x1
+ field public static final int TYPE_SYSTEM_CODE = 3; // 0x3
+ field public static final int TYPE_TECHNOLOGY = 2; // 0x2
}
@FlaggedApi("android.nfc.nfc_oem_extension") public final class OemLogItems implements android.os.Parcelable {
diff --git a/nfc/java/android/nfc/NfcRoutingTableEntry.java b/nfc/java/android/nfc/NfcRoutingTableEntry.java
index 4e91377..c2cbbed 100644
--- a/nfc/java/android/nfc/NfcRoutingTableEntry.java
+++ b/nfc/java/android/nfc/NfcRoutingTableEntry.java
@@ -17,8 +17,12 @@
import android.annotation.FlaggedApi;
+import android.annotation.IntDef;
import android.annotation.SystemApi;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/**
* Class to represent an entry of routing table. This class is abstract and extended by
* {@link RoutingTableTechnologyEntry}, {@link RoutingTableProtocolEntry},
@@ -30,10 +34,42 @@
@SystemApi
public abstract class NfcRoutingTableEntry {
private final int mNfceeId;
+ private final int mType;
+
+ /**
+ * AID routing table type.
+ */
+ public static final int TYPE_AID = 0;
+ /**
+ * Protocol routing table type.
+ */
+ public static final int TYPE_PROTOCOL = 1;
+ /**
+ * Technology routing table type.
+ */
+ public static final int TYPE_TECHNOLOGY = 2;
+ /**
+ * System Code routing table type.
+ */
+ public static final int TYPE_SYSTEM_CODE = 3;
+
+ /**
+ * Possible type of this routing table entry.
+ * @hide
+ */
+ @IntDef(prefix = "TYPE_", value = {
+ TYPE_AID,
+ TYPE_PROTOCOL,
+ TYPE_TECHNOLOGY,
+ TYPE_SYSTEM_CODE
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface RoutingTableType {}
/** @hide */
- protected NfcRoutingTableEntry(int nfceeId) {
+ protected NfcRoutingTableEntry(int nfceeId, @RoutingTableType int type) {
mNfceeId = nfceeId;
+ mType = type;
}
/**
@@ -43,4 +79,13 @@
public int getNfceeId() {
return mNfceeId;
}
+
+ /**
+ * Get the type of this entry.
+ * @return an integer defined in {@link RoutingTableType}
+ */
+ @RoutingTableType
+ public int getType() {
+ return mType;
+ }
}
diff --git a/nfc/java/android/nfc/RoutingTableAidEntry.java b/nfc/java/android/nfc/RoutingTableAidEntry.java
index 7634fe3..bf697d6 100644
--- a/nfc/java/android/nfc/RoutingTableAidEntry.java
+++ b/nfc/java/android/nfc/RoutingTableAidEntry.java
@@ -20,7 +20,7 @@
import android.annotation.SystemApi;
/**
- * Represents an AID entry in current routing table.
+ * Represents an Application ID (AID) entry in current routing table.
* @hide
*/
@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
@@ -30,7 +30,7 @@
/** @hide */
public RoutingTableAidEntry(int nfceeId, String value) {
- super(nfceeId);
+ super(nfceeId, TYPE_AID);
this.mValue = value;
}
diff --git a/nfc/java/android/nfc/RoutingTableProtocolEntry.java b/nfc/java/android/nfc/RoutingTableProtocolEntry.java
index 0c5be7d..536de4d 100644
--- a/nfc/java/android/nfc/RoutingTableProtocolEntry.java
+++ b/nfc/java/android/nfc/RoutingTableProtocolEntry.java
@@ -97,7 +97,7 @@
/** @hide */
public RoutingTableProtocolEntry(int nfceeId, @ProtocolValue int value) {
- super(nfceeId);
+ super(nfceeId, TYPE_PROTOCOL);
this.mValue = value;
}
diff --git a/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java b/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java
index f87ad5f..f61892d 100644
--- a/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java
+++ b/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java
@@ -20,7 +20,9 @@
import android.annotation.SystemApi;
/**
- * Represents a system code entry in current routing table.
+ * Represents a system code entry in current routing table, where system codes are two-byte values
+ * used in NFC-F technology (a type of NFC communication) to identify specific
+ * device configurations.
* @hide
*/
@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
@@ -30,7 +32,7 @@
/** @hide */
public RoutingTableSystemCodeEntry(int nfceeId, byte[] value) {
- super(nfceeId);
+ super(nfceeId, TYPE_SYSTEM_CODE);
this.mValue = value;
}
diff --git a/nfc/java/android/nfc/RoutingTableTechnologyEntry.java b/nfc/java/android/nfc/RoutingTableTechnologyEntry.java
index f51a529..2dbc942 100644
--- a/nfc/java/android/nfc/RoutingTableTechnologyEntry.java
+++ b/nfc/java/android/nfc/RoutingTableTechnologyEntry.java
@@ -30,22 +30,27 @@
@SystemApi
public class RoutingTableTechnologyEntry extends NfcRoutingTableEntry {
/**
- * Technology-A
+ * Technology-A.
+ * <p>Tech-A is mostly used for payment and ticketing applications. It supports various
+ * Tag platforms including Type 1, Type 2 and Type 4A tags. </p>
*/
@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
public static final int TECHNOLOGY_A = 0;
/**
- * Technology-B
+ * Technology-B which is based on ISO/IEC 14443-3 standard.
*/
@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
public static final int TECHNOLOGY_B = 1;
/**
- * Technology-F
+ * Technology-F.
+ * <p>Tech-F is a standard which supports Type 3 Tags and NFC-DEP protocol etc.</p>
*/
@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
public static final int TECHNOLOGY_F = 2;
/**
- * Technology-V
+ * Technology-V.
+ * <p>Tech-V is an NFC technology used for communication with passive tags that operate
+ * at a longer range than other NFC technologies. </p>
*/
@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
public static final int TECHNOLOGY_V = 3;
@@ -73,7 +78,7 @@
/** @hide */
public RoutingTableTechnologyEntry(int nfceeId, @TechnologyValue int value) {
- super(nfceeId);
+ super(nfceeId, TYPE_TECHNOLOGY);
this.mValue = value;
}