Loading api/current.xml +5 −14 Original line number Diff line number Diff line Loading @@ -119763,7 +119763,9 @@ </parameter> <parameter name="intent" type="android.app.PendingIntent"> </parameter> <parameter name="filters" type="android.content.IntentFilter..."> <parameter name="filters" type="android.content.IntentFilter[]"> </parameter> <parameter name="techLists" type="java.lang.String[][]"> </parameter> </method> <method name="enableForegroundNdefPush" Loading Loading @@ -119952,8 +119954,8 @@ visibility="public" > </method> <method name="getTechnologyList" return="int[]" <method name="getTechList" return="java.lang.String[]" abstract="false" native="false" synchronized="false" Loading Loading @@ -120064,17 +120066,6 @@ visibility="public" > </method> <method name="getTechnologyId" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="isConnected" return="boolean" abstract="false" core/java/android/nfc/INfcAdapter.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.ComponentName; import android.content.IntentFilter; import android.nfc.NdefMessage; import android.nfc.Tag; import android.nfc.TechListParcel; import android.nfc.ILlcpSocket; import android.nfc.ILlcpServiceSocket; import android.nfc.ILlcpConnectionlessSocket; Loading Loading @@ -48,7 +49,7 @@ interface INfcAdapter void localSet(in NdefMessage message); void openTagConnection(in Tag tag); void enableForegroundDispatch(in ComponentName activity, in PendingIntent intent, in IntentFilter[] filters); in IntentFilter[] filters, in TechListParcel techLists); void disableForegroundDispatch(in ComponentName activity); void enableForegroundNdefPush(in ComponentName activity, in NdefMessage msg); void disableForegroundNdefPush(in ComponentName activity); Loading core/java/android/nfc/NfcAdapter.java +9 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.IntentFilter; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.os.IBinder; import android.os.Parcel; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; Loading Loading @@ -54,7 +55,7 @@ public final class NfcAdapter { /** * Intent to started when a tag is discovered. The data URI is formated as * {@code vnd.android.nfc://tag/} with the path having a directory entry for each technology * in the {@link Tag#getTechnologyList()} is ascending order. * in the {@link Tag#getTechList()} is sorted ascending order. * * This intent is started after {@link #ACTION_NDEF_DISCOVERED} and before * {@link #ACTION_TAG_DISCOVERED} Loading Loading @@ -426,7 +427,7 @@ public final class NfcAdapter { * @throws IllegalStateException */ public void enableForegroundDispatch(Activity activity, PendingIntent intent, IntentFilter... filters) { IntentFilter[] filters, String[][] techLists) { if (activity == null || intent == null) { throw new NullPointerException(); } Loading @@ -435,9 +436,14 @@ public final class NfcAdapter { "when your activity is resumed"); } try { TechListParcel parcel = null; if (techLists != null && techLists.length > 0) { parcel = new TechListParcel(techLists); } ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, mForegroundDispatchListener); sService.enableForegroundDispatch(activity.getComponentName(), intent, filters); sService.enableForegroundDispatch(activity.getComponentName(), intent, filters, parcel); } catch (RemoteException e) { attemptDeadServiceRecovery(e); } Loading core/java/android/nfc/Tag.java +53 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,15 @@ package android.nfc; import android.nfc.tech.IsoDep; import android.nfc.tech.MifareClassic; import android.nfc.tech.MifareUltralight; import android.nfc.tech.Ndef; import android.nfc.tech.NdefFormatable; import android.nfc.tech.NfcA; import android.nfc.tech.NfcB; import android.nfc.tech.NfcF; import android.nfc.tech.NfcV; import android.nfc.tech.TagTechnology; import android.os.Bundle; import android.os.Parcel; Loading Loading @@ -49,6 +58,7 @@ import java.util.Arrays; public class Tag implements Parcelable { /*package*/ final byte[] mId; /*package*/ final int[] mTechList; /*package*/ final String[] mTechStringList; /*package*/ final Bundle[] mTechExtras; /*package*/ final int mServiceHandle; // for use by NFC service, 0 indicates a mock /*package*/ final INfcTag mTagService; Loading @@ -66,6 +76,7 @@ public class Tag implements Parcelable { } mId = id; mTechList = Arrays.copyOf(techList, techList.length); mTechStringList = generateTechStringList(techList); // Ensure mTechExtras is as long as mTechList mTechExtras = Arrays.copyOf(techListExtras, techList.length); mServiceHandle = serviceHandle; Loading @@ -88,6 +99,45 @@ public class Tag implements Parcelable { return new Tag(id, techList, techListExtras, 0, null); } private String[] generateTechStringList(int[] techList) { final int size = techList.length; String[] strings = new String[size]; for (int i = 0; i < size; i++) { switch (techList[i]) { case TagTechnology.ISO_DEP: strings[i] = IsoDep.class.getName(); break; case TagTechnology.MIFARE_CLASSIC: strings[i] = MifareClassic.class.getName(); break; case TagTechnology.MIFARE_ULTRALIGHT: strings[i] = MifareUltralight.class.getName(); break; case TagTechnology.NDEF: strings[i] = Ndef.class.getName(); break; case TagTechnology.NDEF_FORMATABLE: strings[i] = NdefFormatable.class.getName(); break; case TagTechnology.NFC_A: strings[i] = NfcA.class.getName(); break; case TagTechnology.NFC_B: strings[i] = NfcB.class.getName(); break; case TagTechnology.NFC_F: strings[i] = NfcF.class.getName(); break; case TagTechnology.NFC_V: strings[i] = NfcV.class.getName(); break; default: throw new IllegalArgumentException("Unknown tech type " + techList[i]); } } return strings; } /** * For use by NfcService only. * @hide Loading @@ -110,13 +160,12 @@ public class Tag implements Parcelable { * Returns technologies present in the tag that this implementation understands, * or a zero length array if there are no supported technologies on this tag. * * The elements of the list are guaranteed be one of the constants defined in * {@link TagTechnology}. * The elements of the list are the names of the classes implementing the technology. * * The ordering of the returned array is undefined and should not be relied upon. */ public int[] getTechnologyList() { return Arrays.copyOf(mTechList, mTechList.length); public String[] getTechList() { return mTechStringList; } /** @hide */ Loading core/java/android/nfc/TechListParcel.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2011 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 TechListParcel; No newline at end of file Loading
api/current.xml +5 −14 Original line number Diff line number Diff line Loading @@ -119763,7 +119763,9 @@ </parameter> <parameter name="intent" type="android.app.PendingIntent"> </parameter> <parameter name="filters" type="android.content.IntentFilter..."> <parameter name="filters" type="android.content.IntentFilter[]"> </parameter> <parameter name="techLists" type="java.lang.String[][]"> </parameter> </method> <method name="enableForegroundNdefPush" Loading Loading @@ -119952,8 +119954,8 @@ visibility="public" > </method> <method name="getTechnologyList" return="int[]" <method name="getTechList" return="java.lang.String[]" abstract="false" native="false" synchronized="false" Loading Loading @@ -120064,17 +120066,6 @@ visibility="public" > </method> <method name="getTechnologyId" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="isConnected" return="boolean" abstract="false"
core/java/android/nfc/INfcAdapter.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.ComponentName; import android.content.IntentFilter; import android.nfc.NdefMessage; import android.nfc.Tag; import android.nfc.TechListParcel; import android.nfc.ILlcpSocket; import android.nfc.ILlcpServiceSocket; import android.nfc.ILlcpConnectionlessSocket; Loading Loading @@ -48,7 +49,7 @@ interface INfcAdapter void localSet(in NdefMessage message); void openTagConnection(in Tag tag); void enableForegroundDispatch(in ComponentName activity, in PendingIntent intent, in IntentFilter[] filters); in IntentFilter[] filters, in TechListParcel techLists); void disableForegroundDispatch(in ComponentName activity); void enableForegroundNdefPush(in ComponentName activity, in NdefMessage msg); void disableForegroundNdefPush(in ComponentName activity); Loading
core/java/android/nfc/NfcAdapter.java +9 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.IntentFilter; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.os.IBinder; import android.os.Parcel; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; Loading Loading @@ -54,7 +55,7 @@ public final class NfcAdapter { /** * Intent to started when a tag is discovered. The data URI is formated as * {@code vnd.android.nfc://tag/} with the path having a directory entry for each technology * in the {@link Tag#getTechnologyList()} is ascending order. * in the {@link Tag#getTechList()} is sorted ascending order. * * This intent is started after {@link #ACTION_NDEF_DISCOVERED} and before * {@link #ACTION_TAG_DISCOVERED} Loading Loading @@ -426,7 +427,7 @@ public final class NfcAdapter { * @throws IllegalStateException */ public void enableForegroundDispatch(Activity activity, PendingIntent intent, IntentFilter... filters) { IntentFilter[] filters, String[][] techLists) { if (activity == null || intent == null) { throw new NullPointerException(); } Loading @@ -435,9 +436,14 @@ public final class NfcAdapter { "when your activity is resumed"); } try { TechListParcel parcel = null; if (techLists != null && techLists.length > 0) { parcel = new TechListParcel(techLists); } ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, mForegroundDispatchListener); sService.enableForegroundDispatch(activity.getComponentName(), intent, filters); sService.enableForegroundDispatch(activity.getComponentName(), intent, filters, parcel); } catch (RemoteException e) { attemptDeadServiceRecovery(e); } Loading
core/java/android/nfc/Tag.java +53 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,15 @@ package android.nfc; import android.nfc.tech.IsoDep; import android.nfc.tech.MifareClassic; import android.nfc.tech.MifareUltralight; import android.nfc.tech.Ndef; import android.nfc.tech.NdefFormatable; import android.nfc.tech.NfcA; import android.nfc.tech.NfcB; import android.nfc.tech.NfcF; import android.nfc.tech.NfcV; import android.nfc.tech.TagTechnology; import android.os.Bundle; import android.os.Parcel; Loading Loading @@ -49,6 +58,7 @@ import java.util.Arrays; public class Tag implements Parcelable { /*package*/ final byte[] mId; /*package*/ final int[] mTechList; /*package*/ final String[] mTechStringList; /*package*/ final Bundle[] mTechExtras; /*package*/ final int mServiceHandle; // for use by NFC service, 0 indicates a mock /*package*/ final INfcTag mTagService; Loading @@ -66,6 +76,7 @@ public class Tag implements Parcelable { } mId = id; mTechList = Arrays.copyOf(techList, techList.length); mTechStringList = generateTechStringList(techList); // Ensure mTechExtras is as long as mTechList mTechExtras = Arrays.copyOf(techListExtras, techList.length); mServiceHandle = serviceHandle; Loading @@ -88,6 +99,45 @@ public class Tag implements Parcelable { return new Tag(id, techList, techListExtras, 0, null); } private String[] generateTechStringList(int[] techList) { final int size = techList.length; String[] strings = new String[size]; for (int i = 0; i < size; i++) { switch (techList[i]) { case TagTechnology.ISO_DEP: strings[i] = IsoDep.class.getName(); break; case TagTechnology.MIFARE_CLASSIC: strings[i] = MifareClassic.class.getName(); break; case TagTechnology.MIFARE_ULTRALIGHT: strings[i] = MifareUltralight.class.getName(); break; case TagTechnology.NDEF: strings[i] = Ndef.class.getName(); break; case TagTechnology.NDEF_FORMATABLE: strings[i] = NdefFormatable.class.getName(); break; case TagTechnology.NFC_A: strings[i] = NfcA.class.getName(); break; case TagTechnology.NFC_B: strings[i] = NfcB.class.getName(); break; case TagTechnology.NFC_F: strings[i] = NfcF.class.getName(); break; case TagTechnology.NFC_V: strings[i] = NfcV.class.getName(); break; default: throw new IllegalArgumentException("Unknown tech type " + techList[i]); } } return strings; } /** * For use by NfcService only. * @hide Loading @@ -110,13 +160,12 @@ public class Tag implements Parcelable { * Returns technologies present in the tag that this implementation understands, * or a zero length array if there are no supported technologies on this tag. * * The elements of the list are guaranteed be one of the constants defined in * {@link TagTechnology}. * The elements of the list are the names of the classes implementing the technology. * * The ordering of the returned array is undefined and should not be relied upon. */ public int[] getTechnologyList() { return Arrays.copyOf(mTechList, mTechList.length); public String[] getTechList() { return mTechStringList; } /** @hide */ Loading
core/java/android/nfc/TechListParcel.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2011 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 TechListParcel; No newline at end of file