[framework] Add getRoutingTable Oem extension API.
Test: compile
Bug: 338255533
Change-Id: Ib66cc45b94ef295ce30de3f1bd97583e56f47f7c
diff --git a/nfc/api/system-current.txt b/nfc/api/system-current.txt
index 80aa7d7..5606467 100644
--- a/nfc/api/system-current.txt
+++ b/nfc/api/system-current.txt
@@ -59,6 +59,7 @@
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void clearPreference();
method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public java.util.List<java.lang.String> getActiveNfceeList();
method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public android.nfc.RoutingStatus getRoutingStatus();
+ method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public java.util.List<android.nfc.NfcRoutingTableEntry> getRoutingTable();
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean hasUserEnabledNfc();
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean isAutoChangeEnabled();
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean isTagPresent();
@@ -109,12 +110,46 @@
method public void onTagDispatch(@NonNull java.util.function.Consumer<java.lang.Boolean>);
}
+ @FlaggedApi("android.nfc.nfc_oem_extension") public abstract class NfcRoutingTableEntry {
+ method public int getNfceeId();
+ }
+
@FlaggedApi("android.nfc.nfc_oem_extension") public class RoutingStatus {
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int getDefaultIsoDepRoute();
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int getDefaultOffHostRoute();
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int getDefaultRoute();
}
+ @FlaggedApi("android.nfc.nfc_oem_extension") public class RoutingTableAidEntry extends android.nfc.NfcRoutingTableEntry {
+ method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public String getAid();
+ }
+
+ @FlaggedApi("android.nfc.nfc_oem_extension") public class RoutingTableProtocolEntry extends android.nfc.NfcRoutingTableEntry {
+ method @FlaggedApi("android.nfc.nfc_oem_extension") public int getProtocol();
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_ISO_DEP = 4; // 0x4
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_NDEF = 7; // 0x7
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_NFC_DEP = 5; // 0x5
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_T1T = 1; // 0x1
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_T2T = 2; // 0x2
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_T3T = 3; // 0x3
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_T5T = 6; // 0x6
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_UNDETERMINED = 0; // 0x0
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int PROTOCOL_UNSUPPORTED = -1; // 0xffffffff
+ }
+
+ @FlaggedApi("android.nfc.nfc_oem_extension") public class RoutingTableSystemCodeEntry extends android.nfc.NfcRoutingTableEntry {
+ method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public byte[] getSystemCode();
+ }
+
+ @FlaggedApi("android.nfc.nfc_oem_extension") public class RoutingTableTechnologyEntry extends android.nfc.NfcRoutingTableEntry {
+ method @FlaggedApi("android.nfc.nfc_oem_extension") public int getTechnology();
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int TECHNOLOGY_A = 0; // 0x0
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int TECHNOLOGY_B = 1; // 0x1
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int TECHNOLOGY_F = 2; // 0x2
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int TECHNOLOGY_UNSUPPORTED = -1; // 0xffffffff
+ field @FlaggedApi("android.nfc.nfc_oem_extension") public static final int TECHNOLOGY_V = 3; // 0x3
+ }
+
}
package android.nfc.cardemulation {
diff --git a/nfc/java/android/nfc/Entry.aidl b/nfc/java/android/nfc/Entry.aidl
new file mode 100644
index 0000000..148c4ec
--- /dev/null
+++ b/nfc/java/android/nfc/Entry.aidl
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2024 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.nfc;
+
+parcelable Entry;
\ No newline at end of file
diff --git a/nfc/java/android/nfc/Entry.java b/nfc/java/android/nfc/Entry.java
new file mode 100644
index 0000000..49d0f10
--- /dev/null
+++ b/nfc/java/android/nfc/Entry.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2024 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.nfc;
+
+import android.annotation.NonNull;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+
+/** @hide */
+public final class Entry implements Parcelable {
+ private final byte mType;
+ private final byte mNfceeId;
+ private final String mEntry;
+
+ public Entry(String entry, byte type, byte nfceeId) {
+ mEntry = entry;
+ mType = type;
+ mNfceeId = nfceeId;
+ }
+
+ public byte getType() {
+ return mType;
+ }
+
+ public byte getNfceeId() {
+ return mNfceeId;
+ }
+
+ public String getEntry() {
+ return mEntry;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ private Entry(Parcel in) {
+ this.mEntry = in.readString();
+ this.mNfceeId = in.readByte();
+ this.mType = in.readByte();
+ }
+
+ public static final @NonNull Parcelable.Creator<Entry> CREATOR =
+ new Parcelable.Creator<Entry>() {
+ @Override
+ public Entry createFromParcel(Parcel in) {
+ return new Entry(in);
+ }
+
+ @Override
+ public Entry[] newArray(int size) {
+ return new Entry[size];
+ }
+ };
+
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeString(mEntry);
+ dest.writeByte(mNfceeId);
+ dest.writeByte(mType);
+ }
+}
diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl
index a166b28..1346bd34 100644
--- a/nfc/java/android/nfc/INfcAdapter.aidl
+++ b/nfc/java/android/nfc/INfcAdapter.aidl
@@ -18,6 +18,7 @@
import android.app.PendingIntent;
import android.content.IntentFilter;
+import android.nfc.Entry;
import android.nfc.NdefMessage;
import android.nfc.Tag;
import android.nfc.TechListParcel;
@@ -117,4 +118,5 @@
void triggerInitialization();
boolean getSettingStatus();
boolean isTagPresent();
+ List<Entry> getRoutingTableEntryList();
}
diff --git a/nfc/java/android/nfc/NfcOemExtension.java b/nfc/java/android/nfc/NfcOemExtension.java
index 0a4c488..604a0f3 100644
--- a/nfc/java/android/nfc/NfcOemExtension.java
+++ b/nfc/java/android/nfc/NfcOemExtension.java
@@ -43,6 +43,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -71,6 +72,11 @@
public final class NfcOemExtension {
private static final String TAG = "NfcOemExtension";
private static final int OEM_EXTENSION_RESPONSE_THRESHOLD_MS = 2000;
+ private static final int TYPE_TECHNOLOGY = 0;
+ private static final int TYPE_PROTOCOL = 1;
+ private static final int TYPE_AID = 2;
+ private static final int TYPE_SYSTEMCODE = 3;
+
private final NfcAdapter mAdapter;
private final NfcOemExtensionCallback mOemNfcExtensionCallback;
private boolean mIsRegistered = false;
@@ -680,6 +686,39 @@
));
}
+ /**
+ * Gets current routing table entries.
+ * @return List of {@link NfcRoutingTableEntry} representing current routing table
+ */
+ @NonNull
+ @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public List<NfcRoutingTableEntry> getRoutingTable() {
+ List<Entry> entryList = NfcAdapter.callServiceReturn(() ->
+ NfcAdapter.sService.getRoutingTableEntryList(), null);
+ List<NfcRoutingTableEntry> result = new ArrayList<>();
+ for (Entry entry : entryList) {
+ switch (entry.getType()) {
+ case TYPE_TECHNOLOGY -> result.add(
+ new RoutingTableTechnologyEntry(entry.getNfceeId(),
+ RoutingTableTechnologyEntry.techStringToInt(entry.getEntry()))
+ );
+ case TYPE_PROTOCOL -> result.add(
+ new RoutingTableProtocolEntry(entry.getNfceeId(),
+ RoutingTableProtocolEntry.protocolStringToInt(entry.getEntry()))
+ );
+ case TYPE_AID -> result.add(
+ new RoutingTableAidEntry(entry.getNfceeId(), entry.getEntry())
+ );
+ case TYPE_SYSTEMCODE -> result.add(
+ new RoutingTableSystemCodeEntry(entry.getNfceeId(),
+ entry.getEntry().getBytes(StandardCharsets.UTF_8))
+ );
+ }
+ }
+ return result;
+ }
+
private final class NfcOemExtensionCallback extends INfcOemExtensionCallback.Stub {
@Override
diff --git a/nfc/java/android/nfc/NfcRoutingTableEntry.java b/nfc/java/android/nfc/NfcRoutingTableEntry.java
new file mode 100644
index 0000000..4e91377
--- /dev/null
+++ b/nfc/java/android/nfc/NfcRoutingTableEntry.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2024 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.nfc;
+
+
+import android.annotation.FlaggedApi;
+import android.annotation.SystemApi;
+
+/**
+ * Class to represent an entry of routing table. This class is abstract and extended by
+ * {@link RoutingTableTechnologyEntry}, {@link RoutingTableProtocolEntry},
+ * {@link RoutingTableAidEntry} and {@link RoutingTableSystemCodeEntry}.
+ *
+ * @hide
+ */
+@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+@SystemApi
+public abstract class NfcRoutingTableEntry {
+ private final int mNfceeId;
+
+ /** @hide */
+ protected NfcRoutingTableEntry(int nfceeId) {
+ mNfceeId = nfceeId;
+ }
+
+ /**
+ * Gets the NFCEE Id of this entry.
+ * @return an integer of NFCEE Id.
+ */
+ public int getNfceeId() {
+ return mNfceeId;
+ }
+}
diff --git a/nfc/java/android/nfc/RoutingTableAidEntry.java b/nfc/java/android/nfc/RoutingTableAidEntry.java
new file mode 100644
index 0000000..7634fe3
--- /dev/null
+++ b/nfc/java/android/nfc/RoutingTableAidEntry.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2024 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.nfc;
+
+import android.annotation.FlaggedApi;
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
+
+/**
+ * Represents an AID entry in current routing table.
+ * @hide
+ */
+@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+@SystemApi
+public class RoutingTableAidEntry extends NfcRoutingTableEntry {
+ private final String mValue;
+
+ /** @hide */
+ public RoutingTableAidEntry(int nfceeId, String value) {
+ super(nfceeId);
+ this.mValue = value;
+ }
+
+ /**
+ * Gets AID value.
+ * @return String of AID
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ @NonNull
+ public String getAid() {
+ return mValue;
+ }
+}
diff --git a/nfc/java/android/nfc/RoutingTableProtocolEntry.java b/nfc/java/android/nfc/RoutingTableProtocolEntry.java
new file mode 100644
index 0000000..0c5be7d
--- /dev/null
+++ b/nfc/java/android/nfc/RoutingTableProtocolEntry.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2024 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.nfc;
+
+import android.annotation.FlaggedApi;
+import android.annotation.IntDef;
+import android.annotation.SystemApi;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Represents a protocol entry in current routing table.
+ * @hide
+ */
+@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+@SystemApi
+public class RoutingTableProtocolEntry extends NfcRoutingTableEntry {
+ /**
+ * Protocol undetermined.
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_UNDETERMINED = 0;
+ /**
+ * T1T Protocol
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_T1T = 1;
+ /**
+ * T2T Protocol
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_T2T = 2;
+ /**
+ * T3T Protocol
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_T3T = 3;
+ /**
+ * ISO-DEP Protocol
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_ISO_DEP = 4;
+ /**
+ * DEP Protocol
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_NFC_DEP = 5;
+ /**
+ * T5T Protocol
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_T5T = 6;
+ /**
+ * NDEF Protocol
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_NDEF = 7;
+ /**
+ * Unsupported Protocol
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int PROTOCOL_UNSUPPORTED = -1;
+
+ /**
+ *
+ * @hide
+ */
+ @IntDef(prefix = { "PROTOCOL_" }, value = {
+ PROTOCOL_UNDETERMINED,
+ PROTOCOL_T1T,
+ PROTOCOL_T2T,
+ PROTOCOL_T3T,
+ PROTOCOL_ISO_DEP,
+ PROTOCOL_NFC_DEP,
+ PROTOCOL_T5T,
+ PROTOCOL_NDEF,
+ PROTOCOL_UNSUPPORTED
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ProtocolValue {}
+
+ private final @ProtocolValue int mValue;
+
+ /** @hide */
+ public RoutingTableProtocolEntry(int nfceeId, @ProtocolValue int value) {
+ super(nfceeId);
+ this.mValue = value;
+ }
+
+ /**
+ * Gets Protocol value.
+ * @return Protocol defined in {@link ProtocolValue}
+ */
+ @ProtocolValue
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public int getProtocol() {
+ return mValue;
+ }
+
+ /** @hide */
+ @ProtocolValue
+ public static int protocolStringToInt(String protocolString) {
+ return switch (protocolString) {
+ case "PROTOCOL_T1T" -> PROTOCOL_T1T;
+ case "PROTOCOL_T2T" -> PROTOCOL_T2T;
+ case "PROTOCOL_T3T" -> PROTOCOL_T3T;
+ case "PROTOCOL_ISO_DEP" -> PROTOCOL_ISO_DEP;
+ case "PROTOCOL_NFC_DEP" -> PROTOCOL_NFC_DEP;
+ case "PROTOCOL_T5T" -> PROTOCOL_T5T;
+ case "PROTOCOL_NDEF" -> PROTOCOL_NDEF;
+ case "PROTOCOL_UNDETERMINED" -> PROTOCOL_UNDETERMINED;
+ default -> PROTOCOL_UNSUPPORTED;
+ };
+ }
+}
diff --git a/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java b/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java
new file mode 100644
index 0000000..f87ad5f
--- /dev/null
+++ b/nfc/java/android/nfc/RoutingTableSystemCodeEntry.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2024 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.nfc;
+
+import android.annotation.FlaggedApi;
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
+
+/**
+ * Represents a system code entry in current routing table.
+ * @hide
+ */
+@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+@SystemApi
+public class RoutingTableSystemCodeEntry extends NfcRoutingTableEntry {
+ private final byte[] mValue;
+
+ /** @hide */
+ public RoutingTableSystemCodeEntry(int nfceeId, byte[] value) {
+ super(nfceeId);
+ this.mValue = value;
+ }
+
+ /**
+ * Gets system code value.
+ * @return Byte array of system code
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ @NonNull
+ public byte[] getSystemCode() {
+ return mValue;
+ }
+}
diff --git a/nfc/java/android/nfc/RoutingTableTechnologyEntry.java b/nfc/java/android/nfc/RoutingTableTechnologyEntry.java
new file mode 100644
index 0000000..f51a529
--- /dev/null
+++ b/nfc/java/android/nfc/RoutingTableTechnologyEntry.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2024 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.nfc;
+
+import android.annotation.FlaggedApi;
+import android.annotation.IntDef;
+import android.annotation.SystemApi;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Represents a technology entry in current routing table.
+ * @hide
+ */
+@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+@SystemApi
+public class RoutingTableTechnologyEntry extends NfcRoutingTableEntry {
+ /**
+ * Technology-A
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int TECHNOLOGY_A = 0;
+ /**
+ * Technology-B
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int TECHNOLOGY_B = 1;
+ /**
+ * Technology-F
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int TECHNOLOGY_F = 2;
+ /**
+ * Technology-V
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int TECHNOLOGY_V = 3;
+ /**
+ * Unsupported technology
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public static final int TECHNOLOGY_UNSUPPORTED = -1;
+
+ /**
+ *
+ * @hide
+ */
+ @IntDef(prefix = { "TECHNOLOGY_" }, value = {
+ TECHNOLOGY_A,
+ TECHNOLOGY_B,
+ TECHNOLOGY_F,
+ TECHNOLOGY_V,
+ TECHNOLOGY_UNSUPPORTED
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface TechnologyValue{}
+
+ private final @TechnologyValue int mValue;
+
+ /** @hide */
+ public RoutingTableTechnologyEntry(int nfceeId, @TechnologyValue int value) {
+ super(nfceeId);
+ this.mValue = value;
+ }
+
+ /**
+ * Gets technology value.
+ * @return technology value
+ */
+ @TechnologyValue
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public int getTechnology() {
+ return mValue;
+ }
+
+ /** @hide */
+ @TechnologyValue
+ public static int techStringToInt(String tech) {
+ return switch (tech) {
+ case "TECHNOLOGY_A" -> TECHNOLOGY_A;
+ case "TECHNOLOGY_B" -> TECHNOLOGY_B;
+ case "TECHNOLOGY_F" -> TECHNOLOGY_F;
+ case "TECHNOLOGY_V" -> TECHNOLOGY_V;
+ default -> TECHNOLOGY_UNSUPPORTED;
+ };
+ }
+}