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

Commit ce3224cd authored by Jeff Hamilton's avatar Jeff Hamilton
Browse files

Javadoc updates for NFC.

Change-Id: Ibd91829979576297599fbcc9eb8054924af1d527
parent 33ff2405
Loading
Loading
Loading
Loading
+82 −201
Original line number Diff line number Diff line
@@ -100830,7 +100830,7 @@
<parameter name="activity" type="android.app.Activity">
</parameter>
</method>
<method name="disableNdefPushDispatch"
<method name="disableForegroundNdefPush"
 return="void"
 abstract="false"
 native="false"
@@ -101111,17 +101111,6 @@
>
<implements name="android.nfc.technology.TagTechnology">
</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"
 return="void"
 abstract="false"
@@ -101192,21 +101181,6 @@
<exception name="IOException" type="java.io.IOException">
</exception>
</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 name="IsoDep"
 extends="android.nfc.technology.BasicTagTechnology"
@@ -101216,23 +101190,18 @@
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="IsoDep"
 type="android.nfc.technology.IsoDep"
<method name="getHiLayerResponse"
 return="byte[]"
 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="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"
</method>
<method name="getHistoricalBytes"
 return="byte[]"
 abstract="false"
 native="false"
@@ -101243,7 +101212,7 @@
 visibility="public"
>
</method>
<method name="getHistoricalBytes"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
@@ -101253,6 +101222,10 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="data" type="byte[]">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
</class>
<class name="MifareClassic"
@@ -101263,22 +101236,6 @@
 deprecated="not deprecated"
 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"
 return="boolean"
 abstract="false"
@@ -101471,6 +101428,21 @@
<exception name="IOException" type="java.io.IOException">
</exception>
</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"
 return="void"
 abstract="false"
@@ -101621,17 +101593,6 @@
 visibility="public"
>
</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"
 type="int"
 transient="false"
@@ -101654,17 +101615,6 @@
 visibility="public"
>
</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"
 type="int"
 transient="false"
@@ -101685,22 +101635,6 @@
 deprecated="not deprecated"
 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"
 return="int"
 abstract="false"
@@ -101722,12 +101656,12 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="block" type="int">
<parameter name="page" type="int">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="readOTP"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
@@ -101737,21 +101671,6 @@
 deprecated="not deprecated"
 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>
<exception name="IOException" type="java.io.IOException">
@@ -101767,7 +101686,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="block" type="int">
<parameter name="page" type="int">
</parameter>
<parameter name="data" type="byte[]">
</parameter>
@@ -101838,21 +101757,6 @@
 visibility="public"
>
</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"
 return="int"
 abstract="false"
@@ -101914,25 +101818,6 @@
<exception name="IOException" type="java.io.IOException">
</exception>
</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"
 return="void"
 abstract="false"
@@ -102051,24 +101936,19 @@
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="NfcA"
 type="android.nfc.technology.NfcA"
<method name="getAtqa"
 return="byte[]"
 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="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="getAtqa"
 return="byte[]"
</method>
<method name="getSak"
 return="short"
 abstract="false"
 native="false"
 synchronized="false"
@@ -102078,8 +101958,8 @@
 visibility="public"
>
</method>
<method name="getSak"
 return="short"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
 synchronized="false"
@@ -102088,6 +101968,10 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="data" type="byte[]">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
</class>
<class name="NfcB"
@@ -102098,23 +101982,18 @@
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="NfcB"
 type="android.nfc.technology.NfcB"
<method name="getApplicationData"
 return="byte[]"
 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="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"
</method>
<method name="getProtocolInfo"
 return="byte[]"
 abstract="false"
 native="false"
@@ -102125,7 +102004,7 @@
 visibility="public"
>
</method>
<method name="getProtocolInfo"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
@@ -102135,6 +102014,10 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="data" type="byte[]">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
</class>
<class name="NfcF"
@@ -102145,23 +102028,18 @@
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="NfcF"
 type="android.nfc.technology.NfcF"
<method name="getManufacturer"
 return="byte[]"
 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="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"
</method>
<method name="getSystemCode"
 return="byte[]"
 abstract="false"
 native="false"
@@ -102172,7 +102050,7 @@
 visibility="public"
>
</method>
<method name="getSystemCode"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
@@ -102182,6 +102060,10 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="data" type="byte[]">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
</class>
<class name="NfcV"
@@ -102192,23 +102074,18 @@
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="NfcV"
 type="android.nfc.technology.NfcV"
<method name="getDsfId"
 return="byte"
 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="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"
</method>
<method name="getResponseFlags"
 return="byte"
 abstract="false"
 native="false"
@@ -102219,8 +102096,8 @@
 visibility="public"
>
</method>
<method name="getResponseFlags"
 return="byte"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
 synchronized="false"
@@ -102229,6 +102106,10 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="data" type="byte[]">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
</class>
<interface name="TagTechnology"
+10 −0
Original line number Diff line number Diff line
@@ -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) {
        ActivityInfo aInfo = intent.resolveActivityInfo(
                mInitialApplication.getPackageManager(), PackageManager.GET_SHARED_LIBRARY_FILES);
+14 −10
Original line number Diff line number Diff line
@@ -436,7 +436,7 @@ public final class NfcAdapter {
        }
        try {
            ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity,
                    new ForegroundDispatchPausedListener());
                    mForegroundDispatchListener);
            sService.enableForegroundDispatch(activity.getComponentName(), intent, filters);
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
@@ -453,15 +453,17 @@ public final class NfcAdapter {
     * <p>This method must be called from the main thread.
     */
    public void disableForegroundDispatch(Activity activity) {
        ActivityThread.currentActivityThread().unregisterOnActivityPausedListener(activity,
                mForegroundDispatchListener);
        disableForegroundDispatchInternal(activity, false);
    }

    class ForegroundDispatchPausedListener implements OnActivityPausedListener {
    OnActivityPausedListener mForegroundDispatchListener = new OnActivityPausedListener() {
        @Override
        public void onPaused(Activity activity) {
            disableForegroundDispatchInternal(activity, true);
        }
    }
    };

    void disableForegroundDispatchInternal(Activity activity, boolean force) {
        try {
@@ -488,7 +490,7 @@ public final class NfcAdapter {
        }
        try {
            ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity,
                    new ForegroundDispatchPausedListener());
                    mForegroundNdefPushListener);
            sService.enableForegroundNdefPush(activity.getComponentName(), msg);
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
@@ -504,18 +506,20 @@ public final class NfcAdapter {
     *
     * <p>This method must be called from the main thread.
     */
    public void disableNdefPushDispatch(Activity activity) {
        disableForegroundDispatchInternal(activity, false);
    public void disableForegroundNdefPush(Activity activity) {
        ActivityThread.currentActivityThread().unregisterOnActivityPausedListener(activity,
                mForegroundNdefPushListener);
        disableForegroundNdefPushInternal(activity, false);
    }

    class ForegroundNdefPushPausedListener implements OnActivityPausedListener {
    OnActivityPausedListener mForegroundNdefPushListener = new OnActivityPausedListener() {
        @Override
        public void onPaused(Activity activity) {
            disableNdefPushDispatchInternal(activity, true);
        }
            disableForegroundNdefPushInternal(activity, true);
        }
    };

    void disableNdefPushDispatchInternal(Activity activity, boolean force) {
    void disableForegroundNdefPushInternal(Activity activity, boolean force) {
        try {
            sService.disableForegroundNdefPush(activity.getComponentName());
            if (!force && !activity.isResumed()) {
+2 −2
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@ import java.util.Arrays;
/**
 * Represents a (generic) discovered tag.
 * <p>
 * A tag is a passive NFC element, such as NFC Forum Tag's, Mifare class Tags,
 * Sony Felica Tags.
 * A tag is a passive NFC element, such as NFC Forum Tag's, MIFARE class Tags,
 * Sony FeliCa Tags, etc.
 * <p>
 * Tag's have a type and usually have a UID.
 * <p>
+8 −67
Original line number Diff line number Diff line
@@ -39,10 +39,7 @@ import android.util.Log;
    /*package*/ final INfcAdapter mService;
    /*package*/ final INfcTag mTagService;

    /**
     * @hide
     */
    public BasicTagTechnology(NfcAdapter adapter, Tag tag, int tech) throws RemoteException {
    BasicTagTechnology(NfcAdapter adapter, Tag tag, int tech) throws RemoteException {
        int[] techList = tag.getTechnologyList();
        int i;

@@ -64,46 +61,36 @@ import android.util.Log;
        mSelectedTechnology = tech;
    }

    /**
     * @hide
     */
    public BasicTagTechnology(NfcAdapter adapter, Tag tag) throws RemoteException {
    BasicTagTechnology(NfcAdapter adapter, Tag tag) throws RemoteException {
        this(adapter, tag, tag.getTechnologyList()[0]);
    }

    /**
     * Get the {@link Tag} this connection is associated with.
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     */
    @Override
    public Tag getTag() {
        return mTag;
    }

    public void checkConnected() {
    /** Internal helper to throw IllegalStateException if the technology isn't connected */
    void checkConnected() {
       if ((mTag.getConnectedTechnology() != getTechnologyId()) ||
               (mTag.getConnectedTechnology() == -1)) {
           throw new IllegalStateException("Call connect() first!");
       }
    }

    /**
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     */
    @Override
    public int getTechnologyId() {
        return mSelectedTechnology;
    }

    /**
     * Helper to indicate if {@link #transceive transceive()} calls might succeed.
     * Helper to indicate if {@link #connect} has succeeded.
     * <p>
     * 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
     * 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
     * returns true.
     * while using methods that require a connection in case the connection is lost after this
     * method returns.
     */
    public boolean isConnected() {
        if (!mIsConnected) {
@@ -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
    public void connect() throws IOException {
        try {
@@ -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
    public void reconnect() throws IOException {
        if (!mIsConnected) {
@@ -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
    public void close() {
        try {
@@ -204,7 +160,7 @@ import android.util.Log;
        }
    }

    /** internal transceive */
    /** Internal transceive */
    /*package*/ byte[] transceive(byte[] data, boolean raw) throws IOException {
        checkConnected();

@@ -219,19 +175,4 @@ import android.util.Log;
            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