summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2011-01-10 17:26:59 +1100
committerNick Pelly <npelly@google.com>2011-01-10 17:28:03 +1100
commitb4003bf73e8150fa775506ae508cc55011442308 (patch)
treefd165ed8567211bd94f591976e8160d51e0f9ca9 /core/java
parentf54ad8daf6f9dc2b9670ab1abbbfa4308b40bc6a (diff)
downloadframeworks_base-b4003bf73e8150fa775506ae508cc55011442308.zip
frameworks_base-b4003bf73e8150fa775506ae508cc55011442308.tar.gz
frameworks_base-b4003bf73e8150fa775506ae508cc55011442308.tar.bz2
Change Tag.getTechnology(NfcAdapter, int) to NfcAdapter.getTechnology(Tag, int)
The later feels less clumsy. Change-Id: I50f29aef23d2993dcfd25f4c4f2cb0d77bdc0610
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/nfc/NfcAdapter.java11
-rw-r--r--core/java/android/nfc/Tag.java9
-rw-r--r--core/java/android/nfc/technology/IsoDep.java2
-rw-r--r--core/java/android/nfc/technology/MifareClassic.java2
-rw-r--r--core/java/android/nfc/technology/MifareUltralight.java2
-rw-r--r--core/java/android/nfc/technology/Ndef.java2
-rw-r--r--core/java/android/nfc/technology/NdefFormatable.java2
-rw-r--r--core/java/android/nfc/technology/NfcA.java2
-rw-r--r--core/java/android/nfc/technology/NfcB.java2
-rw-r--r--core/java/android/nfc/technology/NfcF.java2
-rw-r--r--core/java/android/nfc/technology/NfcV.java2
11 files changed, 23 insertions, 15 deletions
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index 2ea5105..dfea4d0 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -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;
@@ -371,6 +372,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.
* <p>
diff --git a/core/java/android/nfc/Tag.java b/core/java/android/nfc/Tag.java
index 6cdd9f1..7bd2289 100644
--- a/core/java/android/nfc/Tag.java
+++ b/core/java/android/nfc/Tag.java
@@ -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) {
diff --git a/core/java/android/nfc/technology/IsoDep.java b/core/java/android/nfc/technology/IsoDep.java
index ff11eb2..b301de9 100644
--- a/core/java/android/nfc/technology/IsoDep.java
+++ b/core/java/android/nfc/technology/IsoDep.java
@@ -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
diff --git a/core/java/android/nfc/technology/MifareClassic.java b/core/java/android/nfc/technology/MifareClassic.java
index c5fb361..3be38fe 100644
--- a/core/java/android/nfc/technology/MifareClassic.java
+++ b/core/java/android/nfc/technology/MifareClassic.java
@@ -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;
diff --git a/core/java/android/nfc/technology/MifareUltralight.java b/core/java/android/nfc/technology/MifareUltralight.java
index e53061f..525b85b 100644
--- a/core/java/android/nfc/technology/MifareUltralight.java
+++ b/core/java/android/nfc/technology/MifareUltralight.java
@@ -47,7 +47,7 @@ public final class MifareUltralight extends BasicTagTechnology {
super(adapter, tag, TagTechnology.MIFARE_ULTRALIGHT);
// 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);
mType = TYPE_UNKNOWN;
diff --git a/core/java/android/nfc/technology/Ndef.java b/core/java/android/nfc/technology/Ndef.java
index 3c08c84..ddcec69 100644
--- a/core/java/android/nfc/technology/Ndef.java
+++ b/core/java/android/nfc/technology/Ndef.java
@@ -31,7 +31,7 @@ import java.io.IOException;
* to interact with NDEF data. MiFare Classic cards that present NDEF data may also be used
* via this class. To determine the exact technology being used call {@link #getTechnologyId()}
*
- * <p>You can acquire this kind of connection with {@link Tag#getTechnology}.
+ * <p>You can acquire this kind of connection with {@link NfcAdapter#getTechnology}.
*
* <p class="note"><strong>Note:</strong>
* Use of this class requires the {@link android.Manifest.permission#NFC}
diff --git a/core/java/android/nfc/technology/NdefFormatable.java b/core/java/android/nfc/technology/NdefFormatable.java
index 7fa624f..11161f1 100644
--- a/core/java/android/nfc/technology/NdefFormatable.java
+++ b/core/java/android/nfc/technology/NdefFormatable.java
@@ -29,7 +29,7 @@ import java.io.IOException;
/**
* An interface to a {@link Tag} allowing to format the tag as NDEF.
*
- * <p>You can acquire this kind of interface with {@link Tag#getTechnology}.
+ * <p>You can acquire this kind of interface with {@link NfcAdapter#getTechnology}.
*
* <p class="note"><strong>Note:</strong>
* Use of this class requires the {@link android.Manifest.permission#NFC}
diff --git a/core/java/android/nfc/technology/NfcA.java b/core/java/android/nfc/technology/NfcA.java
index 5cb8190..20fe09e 100644
--- a/core/java/android/nfc/technology/NfcA.java
+++ b/core/java/android/nfc/technology/NfcA.java
@@ -25,7 +25,7 @@ import android.os.RemoteException;
* A low-level connection to a {@link Tag} using the NFC-A technology, also known as
* ISO1443-3A.
*
- * <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
diff --git a/core/java/android/nfc/technology/NfcB.java b/core/java/android/nfc/technology/NfcB.java
index dc9dd7a..767558e 100644
--- a/core/java/android/nfc/technology/NfcB.java
+++ b/core/java/android/nfc/technology/NfcB.java
@@ -25,7 +25,7 @@ import android.os.RemoteException;
* A low-level connection to a {@link Tag} using the NFC-B technology, also known as
* ISO1443-3B.
*
- * <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
diff --git a/core/java/android/nfc/technology/NfcF.java b/core/java/android/nfc/technology/NfcF.java
index dd0e2f9..f7f1fd3 100644
--- a/core/java/android/nfc/technology/NfcF.java
+++ b/core/java/android/nfc/technology/NfcF.java
@@ -25,7 +25,7 @@ import android.os.RemoteException;
* A low-level connection to a {@link Tag} using the NFC-F technology, also known as
* JIS6319-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
diff --git a/core/java/android/nfc/technology/NfcV.java b/core/java/android/nfc/technology/NfcV.java
index da73f5d..4b51119 100644
--- a/core/java/android/nfc/technology/NfcV.java
+++ b/core/java/android/nfc/technology/NfcV.java
@@ -25,7 +25,7 @@ import android.os.RemoteException;
* A low-level connection to a {@link Tag} using the NFC-V technology, also known as
* ISO15693.
*
- * <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