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

Commit da686f7e authored by The Android Automerger's avatar The Android Automerger
Browse files

Merge branch 'gingerbread' into gingerbread-release

parents 1b1bab99 2b51fcb9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -70,6 +70,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/soundfx/)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/os/storage/*)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/trustedlogic)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/com/trustedlogic)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/trustedlogic)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/com/trustedlogic)

# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+11 −0
Original line number Diff line number Diff line
@@ -705,6 +705,17 @@
 visibility="public"
>
</field>
<field name="NFC"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.permission.NFC&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="PERSISTENT_ACTIVITY"
 type="java.lang.String"
 transient="false"
+10 −5
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import android.util.Log;
 * A connection to an NDEF target on an {@link NdefTag}.
 * <p>You can acquire this kind of connection with {@link NfcAdapter#createNdefTagConnection
 * createNdefTagConnection()}. Use the connection to read or write {@link NdefMessage}s.
 * <p class="note"><strong>Note:</strong>
 * Use of this class requires the {@link android.Manifest.permission#NFC}
 * permission.
 */
public class NdefTagConnection extends RawTagConnection {
    public static final int NDEF_MODE_READ_ONCE = 1;
@@ -69,7 +72,7 @@ public class NdefTagConnection extends RawTagConnection {
     * This will always return the most up to date payload, and can block.
     * It can be canceled with {@link RawTagConnection#close}.
     * Most NDEF tags will contain just one NDEF message.
     * <p>
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     * @throws FormatException if the tag is not NDEF formatted
     * @throws IOException if the target is lost or connection closed
     * @throws FormatException
@@ -109,8 +112,9 @@ public class NdefTagConnection extends RawTagConnection {
     * message. Use {@link NdefRecord} to write several records to a single tag.
     * For write-many tags, use {@link #makeReadOnly} after this method to attempt
     * to prevent further modification. For write-once tags this is not
     * neccesary.
     * Requires NFC_WRITE permission.
     * necessary.
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     *
     * @throws FormatException if the tag is not suitable for NDEF messages
     * @throws IOException if the target is lost or connection closed or the
     *                     write failed
@@ -138,7 +142,7 @@ public class NdefTagConnection extends RawTagConnection {
     * Attempts to make the NDEF data in this tag read-only.
     * This method will block until the action is complete. It can be canceled
     * with {@link RawTagConnection#close}.
     * Requires NFC_WRITE permission.
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     * @return true if the tag is now read-only
     * @throws IOException if the target is lost, or connection closed
     */
@@ -164,7 +168,8 @@ public class NdefTagConnection extends RawTagConnection {

    /**
     * Read/Write mode hint.
     * Provides a hint if further reads or writes are likely to suceed.
     * Provides a hint if further reads or writes are likely to succeed.
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     * @return one of NDEF_MODE
     * @throws IOException if the target is lost or connection closed
     */
+64 −7
Original line number Diff line number Diff line
@@ -15,14 +15,16 @@ import java.lang.UnsupportedOperationException;

import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.app.ActivityThread;
import android.content.Context;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.nfc.INfcAdapter;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;

//TODO(npelly) permission {@link android.Manifest.permission#NFC_MODIFY}
/**
 * Represents the device's local NFC adapter.
 * <p>
@@ -35,7 +37,7 @@ import android.util.Log;
 * to NFC Tags.
 * <p class="note">
 * <strong>Note:</strong> Some methods require the
 * TODO permission.
 * {@link android.Manifest.permission#NFC} permission.
 */
public final class NfcAdapter {
    /**
@@ -72,6 +74,25 @@ public final class NfcAdapter {
    public static final String ACTION_TRANSACTION_DETECTED =
            "android.nfc.action.TRANSACTION_DETECTED";

    /**
     * Broadcast Action: an adapter's state changed between enabled and disabled.
     *
     * The new value is stored in the extra EXTRA_NEW_BOOLEAN_STATE and just contains
     * whether it's enabled or disabled, not including any information about whether it's
     * actively enabling or disabling.
     *
     * @hide
     */
    public static final String ACTION_ADAPTER_STATE_CHANGE =
            "android.nfc.action.ADAPTER_STATE_CHANGE";

    /**
     * The Intent extra for ACTION_ADAPTER_STATE_CHANGE, saying what the new state is.
     *
     * @hide
     */
    public static final String EXTRA_NEW_BOOLEAN_STATE = "android.nfc.isEnabled";

    /**
     * Mandatory byte array extra field in
     * {@link android.nfc.NfcAdapter#ACTION_TRANSACTION_DETECTED}.
@@ -143,6 +164,7 @@ public final class NfcAdapter {

    private static final String TAG = "NFC";

    // Both guarded by NfcAdapter.class:
    private static boolean sIsInitialized = false;
    private static NfcAdapter sAdapter;

@@ -152,6 +174,26 @@ public final class NfcAdapter {
        mService = service;
    }

    /**
     * Helper to check if this device has FEATURE_NFC, but without using
     * a context.
     * Equivalent to
     * context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)
     */
    private static boolean hasNfcFeature() {
        IPackageManager pm = ActivityThread.getPackageManager();
        if (pm == null) {
            Log.e(TAG, "Cannot get package manager, assuming no NFC feature");
            return false;
        }
        try {
            return pm.hasSystemFeature(PackageManager.FEATURE_NFC);
        } catch (RemoteException e) {
            Log.e(TAG, "Package manager query failed, assuming no NFC feature", e);
            return false;
        }
    }

    /**
     * Get a handle to the default NFC Adapter on this Android device.
     * <p>
@@ -166,9 +208,16 @@ public final class NfcAdapter {
            }
            sIsInitialized = true;

            /* is this device meant to have NFC */
            if (!hasNfcFeature()) {
                Log.v(TAG, "this device does not have NFC support");
                return null;
            }

            /* get a handle to NFC service */
            IBinder b = ServiceManager.getService("nfc");
            if (b == null) {
                Log.d(TAG, "NFC Service not available");
                Log.e(TAG, "could not retrieve NFC service");
                return null;
            }

@@ -195,6 +244,9 @@ public final class NfcAdapter {
    }

    /**
     * NOTE: may block for ~second or more.  Poor API.  Avoid
     * calling from the UI thread.
     *
     * @hide
     */
    public boolean enableTagDiscovery() {
@@ -207,6 +259,9 @@ public final class NfcAdapter {
    }

    /**
     * NOTE: may block for ~second or more.  Poor API.  Avoid
     * calling from the UI thread.
     *
     * @hide
     */
    public boolean disableTagDiscovery() {
@@ -231,8 +286,7 @@ public final class NfcAdapter {
     * <li>provide the NDEF message on over LLCP to peer NFC adapters
     * </ul>
     * The NDEF message is preserved across reboot.
     * <p>
     * Requires NFC_WRITE permission
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     *
     * @param message NDEF message to make public
     */
@@ -246,8 +300,7 @@ public final class NfcAdapter {

    /**
     * Get the NDEF Message that this adapter appears as to Tag readers.
     * <p>
     * Requires NFC_WRITE permission
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     *
     * @return NDEF Message that is publicly readable
     */
@@ -262,6 +315,7 @@ public final class NfcAdapter {

    /**
     * Create a raw tag connection to the default Target
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     */
    public RawTagConnection createRawTagConnection(Tag tag) {
        try {
@@ -274,6 +328,7 @@ public final class NfcAdapter {

    /**
     * Create a raw tag connection to the specified Target
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     */
    public RawTagConnection createRawTagConnection(Tag tag, String target) {
        try {
@@ -286,6 +341,7 @@ public final class NfcAdapter {

    /**
     * Create an NDEF tag connection to the default Target
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     */
    public NdefTagConnection createNdefTagConnection(NdefTag tag) {
        try {
@@ -298,6 +354,7 @@ public final class NfcAdapter {

    /**
     * Create an NDEF tag connection to the specified Target
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     */
    public NdefTagConnection createNdefTagConnection(NdefTag tag, String target) {
        try {
+9 −5
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import android.util.Log;
 * Applications must implement their own protocol stack on top of {@link #transceive transceive()}.
 *
 * <p class="note"><strong>Note:</strong>
 * Most methods require the TODO
 * Use of this class requires the {@link android.Manifest.permission#NFC}
 * permission.
 */
public class RawTagConnection {
@@ -71,11 +71,15 @@ public class RawTagConnection {

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

    /**
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     */
    public String getTagTarget() {
        return mSelectedTarget;
    }
@@ -84,7 +88,7 @@ public class RawTagConnection {
     * Helper to indicate if {@link #transceive transceive()} calls might succeed.
     * <p>
     * Does not cause RF activity, and does not block.
     * <p>
     * <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
@@ -104,7 +108,7 @@ public class RawTagConnection {
     * <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
     */
    public void connect() throws IOException {
@@ -120,6 +124,7 @@ public class RawTagConnection {
     * <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.
     */
    public void close() {
        mIsConnected = false;
@@ -135,8 +140,7 @@ public class RawTagConnection {
     * <p>
     * This method will block until the response is received. It can be canceled
     * with {@link #close}.
     * <p>
     * Requires NFC_WRITE permission.
     * <p>Requires {@link android.Manifest.permission#NFC} permission.
     *
     * @param data bytes to send
     * @return bytes received in response
Loading