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

Commit 0716ea14 authored by Jeff Hamilton's avatar Jeff Hamilton Committed by Android (Google) Code Review
Browse files

Merge "Javadoc updates for NFC." into gingerbread

parents 3a223404 ce3224cd
Loading
Loading
Loading
Loading
+82 −201
Original line number Diff line number Diff line
@@ -100802,7 +100802,7 @@
<parameter name="activity" type="android.app.Activity">
</parameter>
</method>
<method name="disableNdefPushDispatch"
<method name="disableForegroundNdefPush"
 return="void"
 abstract="false"
 native="false"
@@ -101083,17 +101083,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"
@@ -101164,21 +101153,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"
@@ -101188,23 +101162,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"
@@ -101215,7 +101184,7 @@
 visibility="public"
>
</method>
<method name="getHistoricalBytes"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
@@ -101225,6 +101194,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"
@@ -101235,22 +101208,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"
@@ -101443,6 +101400,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"
@@ -101593,17 +101565,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"
@@ -101626,17 +101587,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"
@@ -101657,22 +101607,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"
@@ -101694,12 +101628,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"
@@ -101709,21 +101643,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">
@@ -101739,7 +101658,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="block" type="int">
<parameter name="page" type="int">
</parameter>
<parameter name="data" type="byte[]">
</parameter>
@@ -101810,21 +101729,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"
@@ -101886,25 +101790,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"
@@ -102023,24 +101908,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"
@@ -102050,8 +101930,8 @@
 visibility="public"
>
</method>
<method name="getSak"
 return="short"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
 synchronized="false"
@@ -102060,6 +101940,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"
@@ -102070,23 +101954,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"
@@ -102097,7 +101976,7 @@
 visibility="public"
>
</method>
<method name="getProtocolInfo"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
@@ -102107,6 +101986,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"
@@ -102117,23 +102000,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"
@@ -102144,7 +102022,7 @@
 visibility="public"
>
</method>
<method name="getSystemCode"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
@@ -102154,6 +102032,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"
@@ -102164,23 +102046,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"
@@ -102191,8 +102068,8 @@
 visibility="public"
>
</method>
<method name="getResponseFlags"
 return="byte"
<method name="transceive"
 return="byte[]"
 abstract="false"
 native="false"
 synchronized="false"
@@ -102201,6 +102078,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