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

Commit b4003bf7 authored by Nick Pelly's avatar Nick Pelly
Browse files

Change Tag.getTechnology(NfcAdapter, int) to NfcAdapter.getTechnology(Tag, int)

The later feels less clumsy.

Change-Id: I50f29aef23d2993dcfd25f4c4f2cb0d77bdc0610
parent f54ad8da
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -100252,6 +100252,21 @@
 visibility="public"
>
</method>
<method name="getTechnology"
 return="android.nfc.technology.TagTechnology"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="tag" type="android.nfc.Tag">
</parameter>
<parameter name="tech" type="int">
</parameter>
</method>
<method name="isEnabled"
 return="boolean"
 abstract="false"
@@ -100399,21 +100414,6 @@
 visibility="public"
>
</method>
<method name="getTechnology"
 return="android.nfc.technology.TagTechnology"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="adapter" type="android.nfc.NfcAdapter">
</parameter>
<parameter name="tech" type="int">
</parameter>
</method>
<method name="getTechnologyList"
 return="int[]"
 abstract="false"
+11 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.app.ActivityThread;
import android.content.Context;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.nfc.technology.TagTechnology;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -370,6 +371,16 @@ public final class NfcAdapter {
        }
    }

    /**
     * Retrieve a TagTechnology object used to interact with a Tag that is
     * in field.
     * <p>
     * @return TagTechnology object, or null if not present
     */
    public TagTechnology getTechnology(Tag tag, int tech) {
        return tag.getTechnology(NfcAdapter.this, tech);
    }

    /**
     * Set the NDEF Message that this NFC adapter should appear as to Tag
     * readers.
+3 −6
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ import java.util.Arrays;
 * in {@link NfcAdapter#ACTION_TAG_DISCOVERED} intents. A {@link Tag} object is immutable
 * and represents the state of the tag at the time of discovery. It can be
 * directly queried for its UID and Type, or used to create a {@link TagTechnology}
 * (with {@link Tag#getTechnology}).
 * (with {@link NfcAdapter#getTechnology}).
 * <p>
 * A {@link Tag} can  be used to create a {@link TagTechnology} only while the tag is in
 * range. If it is removed and then returned to range, then the most recent
@@ -84,7 +84,7 @@ public class Tag implements Parcelable {
    /**
     * Construct a mock Tag.
     * <p>This is an application constructed tag, so NfcAdapter methods on this
     * Tag such as {@link #getTechnology} may fail with
     * Tag such as {@link NfcAdapter#getTechnology} may fail with
     * {@link IllegalArgumentException} since it does not represent a physical Tag.
     * <p>This constructor might be useful for mock testing.
     * @param id The tag identifier, can be null
@@ -127,10 +127,7 @@ public class Tag implements Parcelable {
        return Arrays.copyOf(mTechList, mTechList.length);
    }

    /**
     * Returns the technology, or null if not present
     */
    public TagTechnology getTechnology(NfcAdapter adapter, int tech) {
    /*package*/ TagTechnology getTechnology(NfcAdapter adapter, int tech) {
        int pos = -1;
        for (int idx = 0; idx < mTechList.length; idx++) {
          if (mTechList[idx] == tech) {
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import java.io.IOException;
 * A low-level connection to a {@link Tag} using the ISO-DEP technology, also known as
 * ISO1443-4.
 *
 * <p>You can acquire this kind of connection with {@link Tag#getTechnology}.
 * <p>You can acquire this kind of connection with {@link NfcAdapter#getTechnology}.
 * Use this class to send and receive data with {@link #transceive transceive()}.
 *
 * <p>Applications must implement their own protocol stack on top of
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ public final class MifareClassic extends BasicTagTechnology {
        super(adapter, tag, TagTechnology.MIFARE_CLASSIC);

        // Check if this could actually be a Mifare
        NfcA a = (NfcA) tag.getTechnology(adapter, TagTechnology.NFC_A);
        NfcA a = (NfcA) adapter.getTechnology(tag, TagTechnology.NFC_A);
        //short[] ATQA = getATQA(tag);

        mIsEmulated = false;
Loading