Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 493e17a4 authored by Roshan Pius's avatar Roshan Pius Committed by Automerger Merge Worker
Browse files

Merge "[framework] Add route type to routingTableEntry." into main am: 4136ebd5

parents 924d8b13 4136ebd5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+9 −1
Original line number Diff line number Diff line
@@ -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);
    }
}
+8 −4
Original line number Diff line number Diff line
@@ -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()))
                );
            }
        }
+15 −1
Original line number Diff line number Diff line
@@ -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;
    }
}
+4 −2
Original line number Diff line number Diff line
@@ -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;
    }

Loading