diff options
| -rw-r--r-- | nfc/api/system-current.txt | 1 | ||||
| -rw-r--r-- | nfc/java/android/nfc/Entry.java | 10 | ||||
| -rw-r--r-- | nfc/java/android/nfc/NfcOemExtension.java | 12 | ||||
| -rw-r--r-- | nfc/java/android/nfc/NfcRoutingTableEntry.java | 16 | ||||
| -rw-r--r-- | nfc/java/android/nfc/RoutingTableAidEntry.java | 6 | ||||
| -rw-r--r-- | nfc/java/android/nfc/RoutingTableProtocolEntry.java | 6 | ||||
| -rw-r--r-- | nfc/java/android/nfc/RoutingTableSystemCodeEntry.java | 6 | ||||
| -rw-r--r-- | nfc/java/android/nfc/RoutingTableTechnologyEntry.java | 6 |
8 files changed, 49 insertions, 14 deletions
diff --git a/nfc/api/system-current.txt b/nfc/api/system-current.txt index 3ed9b7667be7..e97b15d3b926 100644 --- a/nfc/api/system-current.txt +++ b/nfc/api/system-current.txt @@ -124,6 +124,7 @@ package android.nfc { @FlaggedApi("android.nfc.nfc_oem_extension") public abstract class NfcRoutingTableEntry { method public int getNfceeId(); + method public int getRouteType(); method public int getType(); field public static final int TYPE_AID = 0; // 0x0 field public static final int TYPE_PROTOCOL = 1; // 0x1 diff --git a/nfc/java/android/nfc/Entry.java b/nfc/java/android/nfc/Entry.java index 49d0f10dbfce..aa5ba58e7179 100644 --- a/nfc/java/android/nfc/Entry.java +++ b/nfc/java/android/nfc/Entry.java @@ -25,11 +25,13 @@ public final class Entry implements Parcelable { private final byte mType; private final byte mNfceeId; private final String mEntry; + private final String mRoutingType; - public Entry(String entry, byte type, byte nfceeId) { + public Entry(String entry, byte type, byte nfceeId, String routingType) { mEntry = entry; mType = type; mNfceeId = nfceeId; + mRoutingType = routingType; } public byte getType() { @@ -44,6 +46,10 @@ public final class Entry implements Parcelable { return mEntry; } + public String getRoutingType() { + return mRoutingType; + } + @Override public int describeContents() { return 0; @@ -53,6 +59,7 @@ public final class Entry implements Parcelable { this.mEntry = in.readString(); this.mNfceeId = in.readByte(); this.mType = in.readByte(); + this.mRoutingType = in.readString(); } public static final @NonNull Parcelable.Creator<Entry> CREATOR = @@ -73,5 +80,6 @@ public final class Entry implements Parcelable { dest.writeString(mEntry); dest.writeByte(mNfceeId); dest.writeByte(mType); + dest.writeString(mRoutingType); } } diff --git a/nfc/java/android/nfc/NfcOemExtension.java b/nfc/java/android/nfc/NfcOemExtension.java index f78161e7cad0..fb11875ec7d7 100644 --- a/nfc/java/android/nfc/NfcOemExtension.java +++ b/nfc/java/android/nfc/NfcOemExtension.java @@ -887,18 +887,22 @@ public final class NfcOemExtension { switch (entry.getType()) { case TYPE_TECHNOLOGY -> result.add( new RoutingTableTechnologyEntry(entry.getNfceeId(), - RoutingTableTechnologyEntry.techStringToInt(entry.getEntry())) + RoutingTableTechnologyEntry.techStringToInt(entry.getEntry()), + routeStringToInt(entry.getRoutingType())) ); case TYPE_PROTOCOL -> result.add( new RoutingTableProtocolEntry(entry.getNfceeId(), - RoutingTableProtocolEntry.protocolStringToInt(entry.getEntry())) + RoutingTableProtocolEntry.protocolStringToInt(entry.getEntry()), + routeStringToInt(entry.getRoutingType())) ); case TYPE_AID -> result.add( - new RoutingTableAidEntry(entry.getNfceeId(), entry.getEntry()) + new RoutingTableAidEntry(entry.getNfceeId(), entry.getEntry(), + routeStringToInt(entry.getRoutingType())) ); case TYPE_SYSTEMCODE -> result.add( new RoutingTableSystemCodeEntry(entry.getNfceeId(), - entry.getEntry().getBytes(StandardCharsets.UTF_8)) + entry.getEntry().getBytes(StandardCharsets.UTF_8), + routeStringToInt(entry.getRoutingType())) ); } } diff --git a/nfc/java/android/nfc/NfcRoutingTableEntry.java b/nfc/java/android/nfc/NfcRoutingTableEntry.java index c2cbbede9b75..4153779a8ba2 100644 --- a/nfc/java/android/nfc/NfcRoutingTableEntry.java +++ b/nfc/java/android/nfc/NfcRoutingTableEntry.java @@ -19,6 +19,7 @@ package android.nfc; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.SystemApi; +import android.nfc.cardemulation.CardEmulation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -35,6 +36,7 @@ import java.lang.annotation.RetentionPolicy; public abstract class NfcRoutingTableEntry { private final int mNfceeId; private final int mType; + private final int mRouteType; /** * AID routing table type. @@ -67,9 +69,11 @@ public abstract class NfcRoutingTableEntry { public @interface RoutingTableType {} /** @hide */ - protected NfcRoutingTableEntry(int nfceeId, @RoutingTableType int type) { + protected NfcRoutingTableEntry(int nfceeId, @RoutingTableType int type, + @CardEmulation.ProtocolAndTechnologyRoute int routeType) { mNfceeId = nfceeId; mType = type; + mRouteType = routeType; } /** @@ -88,4 +92,14 @@ public abstract class NfcRoutingTableEntry { public int getType() { return mType; } + + /** + * Get the route type of this entry. + * @return an integer defined in + * {@link android.nfc.cardemulation.CardEmulation.ProtocolAndTechnologyRoute} + */ + @CardEmulation.ProtocolAndTechnologyRoute + public int getRouteType() { + return mRouteType; + } } diff --git a/nfc/java/android/nfc/RoutingTableAidEntry.java b/nfc/java/android/nfc/RoutingTableAidEntry.java index bf697d662bd6..be94f9fc117c 100644 --- a/nfc/java/android/nfc/RoutingTableAidEntry.java +++ b/nfc/java/android/nfc/RoutingTableAidEntry.java @@ -18,6 +18,7 @@ package android.nfc; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.SystemApi; +import android.nfc.cardemulation.CardEmulation; /** * Represents an Application ID (AID) entry in current routing table. @@ -29,8 +30,9 @@ public class RoutingTableAidEntry extends NfcRoutingTableEntry { private final String mValue; /** @hide */ - public RoutingTableAidEntry(int nfceeId, String value) { - super(nfceeId, TYPE_AID); + public RoutingTableAidEntry(int nfceeId, String value, + @CardEmulation.ProtocolAndTechnologyRoute int routeType) { + super(nfceeId, TYPE_AID, routeType); this.mValue = value; } diff --git a/nfc/java/android/nfc/RoutingTableProtocolEntry.java b/nfc/java/android/nfc/RoutingTableProtocolEntry.java index 536de4d7430e..a68d8c167865 100644 --- a/nfc/java/android/nfc/RoutingTableProtocolEntry.java +++ b/nfc/java/android/nfc/RoutingTableProtocolEntry.java @@ -18,6 +18,7 @@ package android.nfc; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.SystemApi; +import android.nfc.cardemulation.CardEmulation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -96,8 +97,9 @@ public class RoutingTableProtocolEntry extends NfcRoutingTableEntry { private final @ProtocolValue int mValue; /** @hide */ - public RoutingTableProtocolEntry(int nfceeId, @ProtocolValue int value) { - super(nfceeId, TYPE_PROTOCOL); + public RoutingTableProtocolEntry(int nfceeId, @ProtocolValue int value, + @CardEmulation.ProtocolAndTechnologyRoute int routeType) { + super(nfceeId, TYPE_PROTOCOL, routeType); this.mValue = value; } diff --git a/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java b/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java index f61892d31668..06cc0a5f26f1 100644 --- a/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java +++ b/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java @@ -18,6 +18,7 @@ package android.nfc; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.SystemApi; +import android.nfc.cardemulation.CardEmulation; /** * Represents a system code entry in current routing table, where system codes are two-byte values @@ -31,8 +32,9 @@ public class RoutingTableSystemCodeEntry extends NfcRoutingTableEntry { private final byte[] mValue; /** @hide */ - public RoutingTableSystemCodeEntry(int nfceeId, byte[] value) { - super(nfceeId, TYPE_SYSTEM_CODE); + public RoutingTableSystemCodeEntry(int nfceeId, byte[] value, + @CardEmulation.ProtocolAndTechnologyRoute int routeType) { + super(nfceeId, TYPE_SYSTEM_CODE, routeType); this.mValue = value; } diff --git a/nfc/java/android/nfc/RoutingTableTechnologyEntry.java b/nfc/java/android/nfc/RoutingTableTechnologyEntry.java index 2dbc94232b0b..86239ce7a6b2 100644 --- a/nfc/java/android/nfc/RoutingTableTechnologyEntry.java +++ b/nfc/java/android/nfc/RoutingTableTechnologyEntry.java @@ -18,6 +18,7 @@ package android.nfc; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.SystemApi; +import android.nfc.cardemulation.CardEmulation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -77,8 +78,9 @@ public class RoutingTableTechnologyEntry extends NfcRoutingTableEntry { private final @TechnologyValue int mValue; /** @hide */ - public RoutingTableTechnologyEntry(int nfceeId, @TechnologyValue int value) { - super(nfceeId, TYPE_TECHNOLOGY); + public RoutingTableTechnologyEntry(int nfceeId, @TechnologyValue int value, + @CardEmulation.ProtocolAndTechnologyRoute int routeType) { + super(nfceeId, TYPE_TECHNOLOGY, routeType); this.mValue = value; } |