Loading api/current.xml +82 −201 Original line number Original line Diff line number Diff line Loading @@ -100802,7 +100802,7 @@ <parameter name="activity" type="android.app.Activity"> <parameter name="activity" type="android.app.Activity"> </parameter> </parameter> </method> </method> <method name="disableNdefPushDispatch" <method name="disableForegroundNdefPush" return="void" return="void" abstract="false" abstract="false" native="false" native="false" Loading Loading @@ -101083,17 +101083,6 @@ > > <implements name="android.nfc.technology.TagTechnology"> <implements name="android.nfc.technology.TagTechnology"> </implements> </implements> <method name="checkConnected" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="close" <method name="close" return="void" return="void" abstract="false" abstract="false" Loading Loading @@ -101164,21 +101153,6 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="transceive" return="byte[]" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </class> </class> <class name="IsoDep" <class name="IsoDep" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.technology.BasicTagTechnology" Loading @@ -101188,23 +101162,18 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="IsoDep" <method name="getHiLayerResponse" type="android.nfc.technology.IsoDep" return="byte[]" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getHistoricalBytes" <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getHiLayerResponse" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -101215,7 +101184,7 @@ visibility="public" visibility="public" > > </method> </method> <method name="getHistoricalBytes" <method name="transceive" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -101225,6 +101194,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <class name="MifareClassic" <class name="MifareClassic" Loading @@ -101235,22 +101208,6 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="MifareClassic" type="android.nfc.technology.MifareClassic" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="adapter" type="android.nfc.NfcAdapter"> </parameter> <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="authenticateBlock" <method name="authenticateBlock" return="boolean" return="boolean" abstract="false" abstract="false" Loading Loading @@ -101443,6 +101400,21 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="transceive" return="byte[]" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="transfer" <method name="transfer" return="void" return="void" abstract="false" abstract="false" Loading Loading @@ -101593,17 +101565,6 @@ visibility="public" visibility="public" > > </field> </field> <field name="TYPE_DESFIRE" type="int" transient="false" volatile="false" value="3" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="TYPE_PLUS" <field name="TYPE_PLUS" type="int" type="int" transient="false" transient="false" Loading @@ -101626,17 +101587,6 @@ visibility="public" visibility="public" > > </field> </field> <field name="TYPE_ULTRALIGHT" type="int" transient="false" volatile="false" value="4" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="TYPE_UNKNOWN" <field name="TYPE_UNKNOWN" type="int" type="int" transient="false" transient="false" Loading @@ -101657,22 +101607,6 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="MifareUltralight" type="android.nfc.technology.MifareUltralight" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="adapter" type="android.nfc.NfcAdapter"> </parameter> <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getType" <method name="getType" return="int" return="int" abstract="false" abstract="false" Loading @@ -101694,12 +101628,12 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="block" type="int"> <parameter name="page" type="int"> </parameter> </parameter> <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="readOTP" <method name="transceive" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -101709,21 +101643,6 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="writeBlock" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="block" type="int"> </parameter> <parameter name="data" type="byte[]"> <parameter name="data" type="byte[]"> </parameter> </parameter> <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> Loading @@ -101739,7 +101658,7 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="block" type="int"> <parameter name="page" type="int"> </parameter> </parameter> <parameter name="data" type="byte[]"> <parameter name="data" type="byte[]"> </parameter> </parameter> Loading Loading @@ -101810,21 +101729,6 @@ visibility="public" visibility="public" > > </method> </method> <method name="getExtraNdefMessage" return="android.nfc.NdefMessage[]" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <exception name="FormatException" type="android.nfc.FormatException"> </exception> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="getMaxSize" <method name="getMaxSize" return="int" return="int" abstract="false" abstract="false" Loading Loading @@ -101886,25 +101790,6 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="writeExtraNdefMessage" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="i" type="int"> </parameter> <parameter name="msg" type="android.nfc.NdefMessage"> </parameter> <exception name="FormatException" type="android.nfc.FormatException"> </exception> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="writeNdefMessage" <method name="writeNdefMessage" return="void" return="void" abstract="false" abstract="false" Loading Loading @@ -102023,24 +101908,19 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="NfcA" <method name="getAtqa" type="android.nfc.technology.NfcA" return="byte[]" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getSak" <parameter name="tag" type="android.nfc.Tag"> return="short" </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getAtqa" return="byte[]" abstract="false" abstract="false" native="false" native="false" synchronized="false" synchronized="false" Loading @@ -102050,8 +101930,8 @@ visibility="public" visibility="public" > > </method> </method> <method name="getSak" <method name="transceive" return="short" return="byte[]" abstract="false" abstract="false" native="false" native="false" synchronized="false" synchronized="false" Loading @@ -102060,6 +101940,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <class name="NfcB" <class name="NfcB" Loading @@ -102070,23 +101954,18 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="NfcB" <method name="getApplicationData" type="android.nfc.technology.NfcB" return="byte[]" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getProtocolInfo" <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getApplicationData" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -102097,7 +101976,7 @@ visibility="public" visibility="public" > > </method> </method> <method name="getProtocolInfo" <method name="transceive" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -102107,6 +101986,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <class name="NfcF" <class name="NfcF" Loading @@ -102117,23 +102000,18 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="NfcF" <method name="getManufacturer" type="android.nfc.technology.NfcF" return="byte[]" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getSystemCode" <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getManufacturer" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -102144,7 +102022,7 @@ visibility="public" visibility="public" > > </method> </method> <method name="getSystemCode" <method name="transceive" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -102154,6 +102032,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <class name="NfcV" <class name="NfcV" Loading @@ -102164,23 +102046,18 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="NfcV" <method name="getDsfId" type="android.nfc.technology.NfcV" return="byte" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getResponseFlags" <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getDsfId" return="byte" return="byte" abstract="false" abstract="false" native="false" native="false" Loading @@ -102191,8 +102068,8 @@ visibility="public" visibility="public" > > </method> </method> <method name="getResponseFlags" <method name="transceive" return="byte" return="byte[]" abstract="false" abstract="false" native="false" native="false" synchronized="false" synchronized="false" Loading @@ -102201,6 +102078,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <interface name="TagTechnology" <interface name="TagTechnology" core/java/android/app/ActivityThread.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -1439,6 +1439,16 @@ public final class ActivityThread { } } } } public void unregisterOnActivityPausedListener(Activity activity, OnActivityPausedListener listener) { synchronized (mOnPauseListeners) { ArrayList<OnActivityPausedListener> list = mOnPauseListeners.get(activity); if (list != null) { list.remove(listener); } } } public final ActivityInfo resolveActivityInfo(Intent intent) { public final ActivityInfo resolveActivityInfo(Intent intent) { ActivityInfo aInfo = intent.resolveActivityInfo( ActivityInfo aInfo = intent.resolveActivityInfo( mInitialApplication.getPackageManager(), PackageManager.GET_SHARED_LIBRARY_FILES); mInitialApplication.getPackageManager(), PackageManager.GET_SHARED_LIBRARY_FILES); Loading core/java/android/nfc/NfcAdapter.java +14 −10 Original line number Original line Diff line number Diff line Loading @@ -436,7 +436,7 @@ public final class NfcAdapter { } } try { try { ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, new ForegroundDispatchPausedListener()); mForegroundDispatchListener); sService.enableForegroundDispatch(activity.getComponentName(), intent, filters); sService.enableForegroundDispatch(activity.getComponentName(), intent, filters); } catch (RemoteException e) { } catch (RemoteException e) { attemptDeadServiceRecovery(e); attemptDeadServiceRecovery(e); Loading @@ -453,15 +453,17 @@ public final class NfcAdapter { * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. */ */ public void disableForegroundDispatch(Activity activity) { public void disableForegroundDispatch(Activity activity) { ActivityThread.currentActivityThread().unregisterOnActivityPausedListener(activity, mForegroundDispatchListener); disableForegroundDispatchInternal(activity, false); disableForegroundDispatchInternal(activity, false); } } class ForegroundDispatchPausedListener implements OnActivityPausedListener { OnActivityPausedListener mForegroundDispatchListener = new OnActivityPausedListener() { @Override @Override public void onPaused(Activity activity) { public void onPaused(Activity activity) { disableForegroundDispatchInternal(activity, true); disableForegroundDispatchInternal(activity, true); } } } }; void disableForegroundDispatchInternal(Activity activity, boolean force) { void disableForegroundDispatchInternal(Activity activity, boolean force) { try { try { Loading @@ -488,7 +490,7 @@ public final class NfcAdapter { } } try { try { ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, new ForegroundDispatchPausedListener()); mForegroundNdefPushListener); sService.enableForegroundNdefPush(activity.getComponentName(), msg); sService.enableForegroundNdefPush(activity.getComponentName(), msg); } catch (RemoteException e) { } catch (RemoteException e) { attemptDeadServiceRecovery(e); attemptDeadServiceRecovery(e); Loading @@ -504,18 +506,20 @@ public final class NfcAdapter { * * * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. */ */ public void disableNdefPushDispatch(Activity activity) { public void disableForegroundNdefPush(Activity activity) { disableForegroundDispatchInternal(activity, false); ActivityThread.currentActivityThread().unregisterOnActivityPausedListener(activity, mForegroundNdefPushListener); disableForegroundNdefPushInternal(activity, false); } } class ForegroundNdefPushPausedListener implements OnActivityPausedListener { OnActivityPausedListener mForegroundNdefPushListener = new OnActivityPausedListener() { @Override @Override public void onPaused(Activity activity) { public void onPaused(Activity activity) { disableNdefPushDispatchInternal(activity, true); disableForegroundNdefPushInternal(activity, true); } } } }; void disableNdefPushDispatchInternal(Activity activity, boolean force) { void disableForegroundNdefPushInternal(Activity activity, boolean force) { try { try { sService.disableForegroundNdefPush(activity.getComponentName()); sService.disableForegroundNdefPush(activity.getComponentName()); if (!force && !activity.isResumed()) { if (!force && !activity.isResumed()) { Loading core/java/android/nfc/Tag.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -36,8 +36,8 @@ import java.util.Arrays; /** /** * Represents a (generic) discovered tag. * Represents a (generic) discovered tag. * <p> * <p> * A tag is a passive NFC element, such as NFC Forum Tag's, Mifare class Tags, * A tag is a passive NFC element, such as NFC Forum Tag's, MIFARE class Tags, * Sony Felica Tags. * Sony FeliCa Tags, etc. * <p> * <p> * Tag's have a type and usually have a UID. * Tag's have a type and usually have a UID. * <p> * <p> Loading core/java/android/nfc/technology/BasicTagTechnology.java +8 −67 Original line number Original line Diff line number Diff line Loading @@ -39,10 +39,7 @@ import android.util.Log; /*package*/ final INfcAdapter mService; /*package*/ final INfcAdapter mService; /*package*/ final INfcTag mTagService; /*package*/ final INfcTag mTagService; /** BasicTagTechnology(NfcAdapter adapter, Tag tag, int tech) throws RemoteException { * @hide */ public BasicTagTechnology(NfcAdapter adapter, Tag tag, int tech) throws RemoteException { int[] techList = tag.getTechnologyList(); int[] techList = tag.getTechnologyList(); int i; int i; Loading @@ -64,46 +61,36 @@ import android.util.Log; mSelectedTechnology = tech; mSelectedTechnology = tech; } } /** BasicTagTechnology(NfcAdapter adapter, Tag tag) throws RemoteException { * @hide */ public BasicTagTechnology(NfcAdapter adapter, Tag tag) throws RemoteException { this(adapter, tag, tag.getTechnologyList()[0]); this(adapter, tag, tag.getTechnologyList()[0]); } } /** * Get the {@link Tag} this connection is associated with. * <p>Requires {@link android.Manifest.permission#NFC} permission. */ @Override @Override public Tag getTag() { public Tag getTag() { return mTag; return mTag; } } public void checkConnected() { /** Internal helper to throw IllegalStateException if the technology isn't connected */ void checkConnected() { if ((mTag.getConnectedTechnology() != getTechnologyId()) || if ((mTag.getConnectedTechnology() != getTechnologyId()) || (mTag.getConnectedTechnology() == -1)) { (mTag.getConnectedTechnology() == -1)) { throw new IllegalStateException("Call connect() first!"); throw new IllegalStateException("Call connect() first!"); } } } } /** * <p>Requires {@link android.Manifest.permission#NFC} permission. */ @Override @Override public int getTechnologyId() { public int getTechnologyId() { return mSelectedTechnology; return mSelectedTechnology; } } /** /** * Helper to indicate if {@link #transceive transceive()} calls might succeed. * Helper to indicate if {@link #connect} has succeeded. * <p> * <p> * Does not cause RF activity, and does not block. * Does not cause RF activity, and does not block. * <p>Requires {@link android.Manifest.permission#NFC} permission. * @return true if {@link #connect} has completed successfully and the {@link Tag} is believed * @return true if {@link #connect} has completed successfully and the {@link Tag} is believed * to be within range. Applications must still handle {@link java.io.IOException} * to be within range. Applications must still handle {@link java.io.IOException} * while using {@link #transceive transceive()}, in case connection is lost after this method * while using methods that require a connection in case the connection is lost after this * returns true. * method returns. */ */ public boolean isConnected() { public boolean isConnected() { if (!mIsConnected) { if (!mIsConnected) { Loading @@ -118,16 +105,6 @@ import android.util.Log; } } } } /** * Connect to the {@link Tag} associated with this connection. * <p> * This method blocks until the connection is established. * <p> * {@link #close} can be called from another thread to cancel this connection * attempt. * <p>Requires {@link android.Manifest.permission#NFC} permission. * @throws IOException if the target is lost, or connect canceled */ @Override @Override public void connect() throws IOException { public void connect() throws IOException { try { try { Loading @@ -146,17 +123,6 @@ import android.util.Log; } } } } /** * Re-connect to the {@link Tag} associated with this connection. * <p> * Reconnecting to a tag can be used to reset the state of the tag itself. * This method blocks until the connection is re-established. * <p> * {@link #close} can be called from another thread to cancel this connection * attempt. * <p>Requires {@link android.Manifest.permission#NFC} permission. * @throws IOException if the target is lost, or connect canceled */ @Override @Override public void reconnect() throws IOException { public void reconnect() throws IOException { if (!mIsConnected) { if (!mIsConnected) { Loading @@ -179,16 +145,6 @@ import android.util.Log; } } } } /** * Close this connection. * <p> * Causes blocking operations such as {@link #transceive transceive()} or {@link #connect} to * be canceled and immediately throw {@link java.io.IOException}. * <p> * Once this method is called, this object cannot be re-used and should be discarded. Further * calls to {@link #transceive transceive()} or {@link #connect} will fail. * <p>Requires {@link android.Manifest.permission#NFC} permission. */ @Override @Override public void close() { public void close() { try { try { Loading @@ -204,7 +160,7 @@ import android.util.Log; } } } } /** internal transceive */ /** Internal transceive */ /*package*/ byte[] transceive(byte[] data, boolean raw) throws IOException { /*package*/ byte[] transceive(byte[] data, boolean raw) throws IOException { checkConnected(); checkConnected(); Loading @@ -219,19 +175,4 @@ import android.util.Log; throw new IOException("NFC service died"); throw new IOException("NFC service died"); } } } } /** * Send data to a tag and receive the response. * <p> * This method will block until the response is received. It can be canceled * with {@link #close}. * <p>Requires {@link android.Manifest.permission#NFC} permission. * * @param data bytes to send * @return bytes received in response * @throws IOException if the target is lost or connection closed */ public byte[] transceive(byte[] data) throws IOException { return transceive(data, true); } } } Loading
api/current.xml +82 −201 Original line number Original line Diff line number Diff line Loading @@ -100802,7 +100802,7 @@ <parameter name="activity" type="android.app.Activity"> <parameter name="activity" type="android.app.Activity"> </parameter> </parameter> </method> </method> <method name="disableNdefPushDispatch" <method name="disableForegroundNdefPush" return="void" return="void" abstract="false" abstract="false" native="false" native="false" Loading Loading @@ -101083,17 +101083,6 @@ > > <implements name="android.nfc.technology.TagTechnology"> <implements name="android.nfc.technology.TagTechnology"> </implements> </implements> <method name="checkConnected" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="close" <method name="close" return="void" return="void" abstract="false" abstract="false" Loading Loading @@ -101164,21 +101153,6 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="transceive" return="byte[]" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </class> </class> <class name="IsoDep" <class name="IsoDep" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.technology.BasicTagTechnology" Loading @@ -101188,23 +101162,18 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="IsoDep" <method name="getHiLayerResponse" type="android.nfc.technology.IsoDep" return="byte[]" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getHistoricalBytes" <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getHiLayerResponse" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -101215,7 +101184,7 @@ visibility="public" visibility="public" > > </method> </method> <method name="getHistoricalBytes" <method name="transceive" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -101225,6 +101194,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <class name="MifareClassic" <class name="MifareClassic" Loading @@ -101235,22 +101208,6 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="MifareClassic" type="android.nfc.technology.MifareClassic" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="adapter" type="android.nfc.NfcAdapter"> </parameter> <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="authenticateBlock" <method name="authenticateBlock" return="boolean" return="boolean" abstract="false" abstract="false" Loading Loading @@ -101443,6 +101400,21 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="transceive" return="byte[]" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="transfer" <method name="transfer" return="void" return="void" abstract="false" abstract="false" Loading Loading @@ -101593,17 +101565,6 @@ visibility="public" visibility="public" > > </field> </field> <field name="TYPE_DESFIRE" type="int" transient="false" volatile="false" value="3" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="TYPE_PLUS" <field name="TYPE_PLUS" type="int" type="int" transient="false" transient="false" Loading @@ -101626,17 +101587,6 @@ visibility="public" visibility="public" > > </field> </field> <field name="TYPE_ULTRALIGHT" type="int" transient="false" volatile="false" value="4" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="TYPE_UNKNOWN" <field name="TYPE_UNKNOWN" type="int" type="int" transient="false" transient="false" Loading @@ -101657,22 +101607,6 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="MifareUltralight" type="android.nfc.technology.MifareUltralight" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="adapter" type="android.nfc.NfcAdapter"> </parameter> <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getType" <method name="getType" return="int" return="int" abstract="false" abstract="false" Loading @@ -101694,12 +101628,12 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="block" type="int"> <parameter name="page" type="int"> </parameter> </parameter> <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="readOTP" <method name="transceive" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -101709,21 +101643,6 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="writeBlock" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="block" type="int"> </parameter> <parameter name="data" type="byte[]"> <parameter name="data" type="byte[]"> </parameter> </parameter> <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> Loading @@ -101739,7 +101658,7 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="block" type="int"> <parameter name="page" type="int"> </parameter> </parameter> <parameter name="data" type="byte[]"> <parameter name="data" type="byte[]"> </parameter> </parameter> Loading Loading @@ -101810,21 +101729,6 @@ visibility="public" visibility="public" > > </method> </method> <method name="getExtraNdefMessage" return="android.nfc.NdefMessage[]" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <exception name="FormatException" type="android.nfc.FormatException"> </exception> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="getMaxSize" <method name="getMaxSize" return="int" return="int" abstract="false" abstract="false" Loading Loading @@ -101886,25 +101790,6 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="writeExtraNdefMessage" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="i" type="int"> </parameter> <parameter name="msg" type="android.nfc.NdefMessage"> </parameter> <exception name="FormatException" type="android.nfc.FormatException"> </exception> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="writeNdefMessage" <method name="writeNdefMessage" return="void" return="void" abstract="false" abstract="false" Loading Loading @@ -102023,24 +101908,19 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="NfcA" <method name="getAtqa" type="android.nfc.technology.NfcA" return="byte[]" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getSak" <parameter name="tag" type="android.nfc.Tag"> return="short" </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getAtqa" return="byte[]" abstract="false" abstract="false" native="false" native="false" synchronized="false" synchronized="false" Loading @@ -102050,8 +101930,8 @@ visibility="public" visibility="public" > > </method> </method> <method name="getSak" <method name="transceive" return="short" return="byte[]" abstract="false" abstract="false" native="false" native="false" synchronized="false" synchronized="false" Loading @@ -102060,6 +101940,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <class name="NfcB" <class name="NfcB" Loading @@ -102070,23 +101954,18 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="NfcB" <method name="getApplicationData" type="android.nfc.technology.NfcB" return="byte[]" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getProtocolInfo" <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getApplicationData" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -102097,7 +101976,7 @@ visibility="public" visibility="public" > > </method> </method> <method name="getProtocolInfo" <method name="transceive" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -102107,6 +101986,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <class name="NfcF" <class name="NfcF" Loading @@ -102117,23 +102000,18 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="NfcF" <method name="getManufacturer" type="android.nfc.technology.NfcF" return="byte[]" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getSystemCode" <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getManufacturer" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -102144,7 +102022,7 @@ visibility="public" visibility="public" > > </method> </method> <method name="getSystemCode" <method name="transceive" return="byte[]" return="byte[]" abstract="false" abstract="false" native="false" native="false" Loading @@ -102154,6 +102032,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <class name="NfcV" <class name="NfcV" Loading @@ -102164,23 +102046,18 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <constructor name="NfcV" <method name="getDsfId" type="android.nfc.technology.NfcV" return="byte" abstract="false" native="false" synchronized="false" static="false" static="false" final="false" final="false" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="adapter" type="android.nfc.NfcAdapter"> </method> </parameter> <method name="getResponseFlags" <parameter name="tag" type="android.nfc.Tag"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <exception name="RemoteException" type="android.os.RemoteException"> </exception> </constructor> <method name="getDsfId" return="byte" return="byte" abstract="false" abstract="false" native="false" native="false" Loading @@ -102191,8 +102068,8 @@ visibility="public" visibility="public" > > </method> </method> <method name="getResponseFlags" <method name="transceive" return="byte" return="byte[]" abstract="false" abstract="false" native="false" native="false" synchronized="false" synchronized="false" Loading @@ -102201,6 +102078,10 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <parameter name="data" type="byte[]"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> </method> </class> </class> <interface name="TagTechnology" <interface name="TagTechnology"
core/java/android/app/ActivityThread.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -1439,6 +1439,16 @@ public final class ActivityThread { } } } } public void unregisterOnActivityPausedListener(Activity activity, OnActivityPausedListener listener) { synchronized (mOnPauseListeners) { ArrayList<OnActivityPausedListener> list = mOnPauseListeners.get(activity); if (list != null) { list.remove(listener); } } } public final ActivityInfo resolveActivityInfo(Intent intent) { public final ActivityInfo resolveActivityInfo(Intent intent) { ActivityInfo aInfo = intent.resolveActivityInfo( ActivityInfo aInfo = intent.resolveActivityInfo( mInitialApplication.getPackageManager(), PackageManager.GET_SHARED_LIBRARY_FILES); mInitialApplication.getPackageManager(), PackageManager.GET_SHARED_LIBRARY_FILES); Loading
core/java/android/nfc/NfcAdapter.java +14 −10 Original line number Original line Diff line number Diff line Loading @@ -436,7 +436,7 @@ public final class NfcAdapter { } } try { try { ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, new ForegroundDispatchPausedListener()); mForegroundDispatchListener); sService.enableForegroundDispatch(activity.getComponentName(), intent, filters); sService.enableForegroundDispatch(activity.getComponentName(), intent, filters); } catch (RemoteException e) { } catch (RemoteException e) { attemptDeadServiceRecovery(e); attemptDeadServiceRecovery(e); Loading @@ -453,15 +453,17 @@ public final class NfcAdapter { * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. */ */ public void disableForegroundDispatch(Activity activity) { public void disableForegroundDispatch(Activity activity) { ActivityThread.currentActivityThread().unregisterOnActivityPausedListener(activity, mForegroundDispatchListener); disableForegroundDispatchInternal(activity, false); disableForegroundDispatchInternal(activity, false); } } class ForegroundDispatchPausedListener implements OnActivityPausedListener { OnActivityPausedListener mForegroundDispatchListener = new OnActivityPausedListener() { @Override @Override public void onPaused(Activity activity) { public void onPaused(Activity activity) { disableForegroundDispatchInternal(activity, true); disableForegroundDispatchInternal(activity, true); } } } }; void disableForegroundDispatchInternal(Activity activity, boolean force) { void disableForegroundDispatchInternal(Activity activity, boolean force) { try { try { Loading @@ -488,7 +490,7 @@ public final class NfcAdapter { } } try { try { ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, new ForegroundDispatchPausedListener()); mForegroundNdefPushListener); sService.enableForegroundNdefPush(activity.getComponentName(), msg); sService.enableForegroundNdefPush(activity.getComponentName(), msg); } catch (RemoteException e) { } catch (RemoteException e) { attemptDeadServiceRecovery(e); attemptDeadServiceRecovery(e); Loading @@ -504,18 +506,20 @@ public final class NfcAdapter { * * * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. */ */ public void disableNdefPushDispatch(Activity activity) { public void disableForegroundNdefPush(Activity activity) { disableForegroundDispatchInternal(activity, false); ActivityThread.currentActivityThread().unregisterOnActivityPausedListener(activity, mForegroundNdefPushListener); disableForegroundNdefPushInternal(activity, false); } } class ForegroundNdefPushPausedListener implements OnActivityPausedListener { OnActivityPausedListener mForegroundNdefPushListener = new OnActivityPausedListener() { @Override @Override public void onPaused(Activity activity) { public void onPaused(Activity activity) { disableNdefPushDispatchInternal(activity, true); disableForegroundNdefPushInternal(activity, true); } } } }; void disableNdefPushDispatchInternal(Activity activity, boolean force) { void disableForegroundNdefPushInternal(Activity activity, boolean force) { try { try { sService.disableForegroundNdefPush(activity.getComponentName()); sService.disableForegroundNdefPush(activity.getComponentName()); if (!force && !activity.isResumed()) { if (!force && !activity.isResumed()) { Loading
core/java/android/nfc/Tag.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -36,8 +36,8 @@ import java.util.Arrays; /** /** * Represents a (generic) discovered tag. * Represents a (generic) discovered tag. * <p> * <p> * A tag is a passive NFC element, such as NFC Forum Tag's, Mifare class Tags, * A tag is a passive NFC element, such as NFC Forum Tag's, MIFARE class Tags, * Sony Felica Tags. * Sony FeliCa Tags, etc. * <p> * <p> * Tag's have a type and usually have a UID. * Tag's have a type and usually have a UID. * <p> * <p> Loading
core/java/android/nfc/technology/BasicTagTechnology.java +8 −67 Original line number Original line Diff line number Diff line Loading @@ -39,10 +39,7 @@ import android.util.Log; /*package*/ final INfcAdapter mService; /*package*/ final INfcAdapter mService; /*package*/ final INfcTag mTagService; /*package*/ final INfcTag mTagService; /** BasicTagTechnology(NfcAdapter adapter, Tag tag, int tech) throws RemoteException { * @hide */ public BasicTagTechnology(NfcAdapter adapter, Tag tag, int tech) throws RemoteException { int[] techList = tag.getTechnologyList(); int[] techList = tag.getTechnologyList(); int i; int i; Loading @@ -64,46 +61,36 @@ import android.util.Log; mSelectedTechnology = tech; mSelectedTechnology = tech; } } /** BasicTagTechnology(NfcAdapter adapter, Tag tag) throws RemoteException { * @hide */ public BasicTagTechnology(NfcAdapter adapter, Tag tag) throws RemoteException { this(adapter, tag, tag.getTechnologyList()[0]); this(adapter, tag, tag.getTechnologyList()[0]); } } /** * Get the {@link Tag} this connection is associated with. * <p>Requires {@link android.Manifest.permission#NFC} permission. */ @Override @Override public Tag getTag() { public Tag getTag() { return mTag; return mTag; } } public void checkConnected() { /** Internal helper to throw IllegalStateException if the technology isn't connected */ void checkConnected() { if ((mTag.getConnectedTechnology() != getTechnologyId()) || if ((mTag.getConnectedTechnology() != getTechnologyId()) || (mTag.getConnectedTechnology() == -1)) { (mTag.getConnectedTechnology() == -1)) { throw new IllegalStateException("Call connect() first!"); throw new IllegalStateException("Call connect() first!"); } } } } /** * <p>Requires {@link android.Manifest.permission#NFC} permission. */ @Override @Override public int getTechnologyId() { public int getTechnologyId() { return mSelectedTechnology; return mSelectedTechnology; } } /** /** * Helper to indicate if {@link #transceive transceive()} calls might succeed. * Helper to indicate if {@link #connect} has succeeded. * <p> * <p> * Does not cause RF activity, and does not block. * Does not cause RF activity, and does not block. * <p>Requires {@link android.Manifest.permission#NFC} permission. * @return true if {@link #connect} has completed successfully and the {@link Tag} is believed * @return true if {@link #connect} has completed successfully and the {@link Tag} is believed * to be within range. Applications must still handle {@link java.io.IOException} * to be within range. Applications must still handle {@link java.io.IOException} * while using {@link #transceive transceive()}, in case connection is lost after this method * while using methods that require a connection in case the connection is lost after this * returns true. * method returns. */ */ public boolean isConnected() { public boolean isConnected() { if (!mIsConnected) { if (!mIsConnected) { Loading @@ -118,16 +105,6 @@ import android.util.Log; } } } } /** * Connect to the {@link Tag} associated with this connection. * <p> * This method blocks until the connection is established. * <p> * {@link #close} can be called from another thread to cancel this connection * attempt. * <p>Requires {@link android.Manifest.permission#NFC} permission. * @throws IOException if the target is lost, or connect canceled */ @Override @Override public void connect() throws IOException { public void connect() throws IOException { try { try { Loading @@ -146,17 +123,6 @@ import android.util.Log; } } } } /** * Re-connect to the {@link Tag} associated with this connection. * <p> * Reconnecting to a tag can be used to reset the state of the tag itself. * This method blocks until the connection is re-established. * <p> * {@link #close} can be called from another thread to cancel this connection * attempt. * <p>Requires {@link android.Manifest.permission#NFC} permission. * @throws IOException if the target is lost, or connect canceled */ @Override @Override public void reconnect() throws IOException { public void reconnect() throws IOException { if (!mIsConnected) { if (!mIsConnected) { Loading @@ -179,16 +145,6 @@ import android.util.Log; } } } } /** * Close this connection. * <p> * Causes blocking operations such as {@link #transceive transceive()} or {@link #connect} to * be canceled and immediately throw {@link java.io.IOException}. * <p> * Once this method is called, this object cannot be re-used and should be discarded. Further * calls to {@link #transceive transceive()} or {@link #connect} will fail. * <p>Requires {@link android.Manifest.permission#NFC} permission. */ @Override @Override public void close() { public void close() { try { try { Loading @@ -204,7 +160,7 @@ import android.util.Log; } } } } /** internal transceive */ /** Internal transceive */ /*package*/ byte[] transceive(byte[] data, boolean raw) throws IOException { /*package*/ byte[] transceive(byte[] data, boolean raw) throws IOException { checkConnected(); checkConnected(); Loading @@ -219,19 +175,4 @@ import android.util.Log; throw new IOException("NFC service died"); throw new IOException("NFC service died"); } } } } /** * Send data to a tag and receive the response. * <p> * This method will block until the response is received. It can be canceled * with {@link #close}. * <p>Requires {@link android.Manifest.permission#NFC} permission. * * @param data bytes to send * @return bytes received in response * @throws IOException if the target is lost or connection closed */ public byte[] transceive(byte[] data) throws IOException { return transceive(data, true); } } }