diff options
author | Nick Pelly <npelly@google.com> | 2012-01-27 10:00:56 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-01-27 10:00:56 -0800 |
commit | 92077cfd66d200b25419a7e8d89cee6fe7e95a01 (patch) | |
tree | 463952ffe8d932c0701a1e79acf4b127c7a49a84 | |
parent | 519d4af6985d42192a2afe04fca3fe09f93018d4 (diff) | |
parent | 4fce619aa6c80bd7ad7e644bdb2b7b8bcdeffd60 (diff) | |
download | packages_apps_nfc-92077cfd66d200b25419a7e8d89cee6fe7e95a01.zip packages_apps_nfc-92077cfd66d200b25419a7e8d89cee6fe7e95a01.tar.gz packages_apps_nfc-92077cfd66d200b25419a7e8d89cee6fe7e95a01.tar.bz2 |
am 4fce619a: Merge "Don\'t need to pass the NdefMessage in dispatch()."
* commit '4fce619aa6c80bd7ad7e644bdb2b7b8bcdeffd60':
Don't need to pass the NdefMessage in dispatch().
-rw-r--r-- | src/com/android/nfc/NfcDispatcher.java | 8 | ||||
-rwxr-xr-x | src/com/android/nfc/NfcService.java | 14 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/com/android/nfc/NfcDispatcher.java b/src/com/android/nfc/NfcDispatcher.java index 715dd57..2f442e6 100644 --- a/src/com/android/nfc/NfcDispatcher.java +++ b/src/com/android/nfc/NfcDispatcher.java @@ -35,6 +35,7 @@ import android.nfc.NdefMessage; import android.nfc.NdefRecord; import android.nfc.NfcAdapter; import android.nfc.Tag; +import android.nfc.tech.Ndef; import android.os.RemoteException; import android.util.Log; @@ -173,7 +174,12 @@ public class NfcDispatcher { } /** Returns false if no activities were found to dispatch to */ - public boolean dispatchTag(Tag tag, NdefMessage message) { + public boolean dispatchTag(Tag tag) { + NdefMessage message = null; + Ndef ndef = Ndef.get(tag); + if (ndef != null) { + message = ndef.getCachedNdefMessage(); + } if (DBG) Log.d(TAG, "dispatch tag: " + tag.toString() + " message: " + message); PendingIntent overrideIntent; diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index 3e16a2e..851e49b 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -782,9 +782,9 @@ public class NfcService extends Application implements DeviceHostListener { } @Override - public void dispatch(Tag tag, NdefMessage message) throws RemoteException { + public void dispatch(Tag tag) throws RemoteException { enforceAdminPerm(mContext); - mNfcDispatcher.dispatchTag(tag, message); + mNfcDispatcher.dispatchTag(tag); } } @@ -1538,7 +1538,7 @@ public class NfcService extends Application implements DeviceHostListener { new Bundle[] { extras }); Log.d(TAG, "mock NDEF tag, starting corresponding activity"); Log.d(TAG, tag.toString()); - boolean delivered = mNfcDispatcher.dispatchTag(tag, ndefMsg); + boolean delivered = mNfcDispatcher.dispatchTag(tag); if (delivered) { playSound(SOUND_END); } else { @@ -1555,11 +1555,11 @@ public class NfcService extends Application implements DeviceHostListener { if (ndefMsg != null) { tag.startPresenceChecking(); - dispatchTagEndpoint(tag, ndefMsg); + dispatchTagEndpoint(tag); } else { if (tag.reconnect()) { tag.startPresenceChecking(); - dispatchTagEndpoint(tag, null); + dispatchTagEndpoint(tag); } else { tag.disconnect(); playSound(SOUND_ERROR); @@ -1747,11 +1747,11 @@ public class NfcService extends Application implements DeviceHostListener { return false; } - private void dispatchTagEndpoint(TagEndpoint tagEndpoint, NdefMessage msg) { + private void dispatchTagEndpoint(TagEndpoint tagEndpoint) { Tag tag = new Tag(tagEndpoint.getUid(), tagEndpoint.getTechList(), tagEndpoint.getTechExtras(), tagEndpoint.getHandle(), mNfcTagService); registerTagObject(tagEndpoint); - if (!mNfcDispatcher.dispatchTag(tag, msg)) { + if (!mNfcDispatcher.dispatchTag(tag)) { unregisterObject(tagEndpoint.getHandle()); playSound(SOUND_ERROR); } else { |