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

Commit 590b73bc authored by Nick Pelly's avatar Nick Pelly
Browse files

NFC API revision round 2.



- Add the second half of the new NFC API: NfcAdapter, Tag, NdefTag,
  RawTagConnection, NdefTagConnection.
- Add implementations for all of the new NFC API.

Change-Id: I8da9fd1d2971ed2c8b76f2a93f207fa9e305b0f6
Signed-off-by: default avatarNick Pelly <npelly@google.com>
parent 45738f67
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -159,14 +159,6 @@ LOCAL_SRC_FILES += \
	core/java/com/android/internal/view/IInputMethodClient.aidl \
	core/java/com/android/internal/view/IInputMethodManager.aidl \
	core/java/com/android/internal/view/IInputMethodSession.aidl \
	core/java/com/trustedlogic/trustednfc/android/ILlcpConnectionlessSocket.aidl \
	core/java/com/trustedlogic/trustednfc/android/ILlcpServiceSocket.aidl \
	core/java/com/trustedlogic/trustednfc/android/ILlcpSocket.aidl \
	core/java/com/trustedlogic/trustednfc/android/INdefTag.aidl \
	core/java/com/trustedlogic/trustednfc/android/INfcManager.aidl \
	core/java/com/trustedlogic/trustednfc/android/INfcTag.aidl \
	core/java/com/trustedlogic/trustednfc/android/IP2pInitiator.aidl \
	core/java/com/trustedlogic/trustednfc/android/IP2pTarget.aidl \
	location/java/android/location/IGeocodeProvider.aidl \
	location/java/android/location/IGpsStatusListener.aidl \
	location/java/android/location/IGpsStatusProvider.aidl \
@@ -249,6 +241,10 @@ aidl_files := \
	frameworks/base/core/java/android/content/res/Configuration.aidl \
	frameworks/base/core/java/android/appwidget/AppWidgetProviderInfo.aidl \
	frameworks/base/core/java/android/net/Uri.aidl \
	frameworks/base/core/java/android/nfc/NdefMessage.aidl \
	frameworks/base/core/java/android/nfc/NdefRecord.aidl \
	frameworks/base/core/java/android/nfc/Tag.aidl \
	frameworks/base/core/java/android/nfc/NdefTag.aidl \
	frameworks/base/core/java/android/os/Bundle.aidl \
	frameworks/base/core/java/android/os/DropBoxManager.aidl \
	frameworks/base/core/java/android/os/ParcelFileDescriptor.aidl \
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libreverb_inte
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libreverbtest_intermediates)
$(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)

# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+653 −0
Original line number Diff line number Diff line
@@ -102984,6 +102984,33 @@
</package>
<package name="android.nfc"
>
<class name="FormatException"
 extends="java.lang.Exception"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="FormatException"
 type="android.nfc.FormatException"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</constructor>
<constructor name="FormatException"
 type="android.nfc.FormatException"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="message" type="java.lang.String">
</parameter>
</constructor>
</class>
<class name="NdefMessage"
 extends="java.lang.Object"
 abstract="false"
@@ -103323,6 +103350,632 @@
>
</field>
</class>
<class name="NdefTag"
 extends="android.nfc.Tag"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.os.Parcelable">
</implements>
<method name="getNdefMessages"
 return="android.nfc.NdefMessage[]"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getNdefMessages"
 return="android.nfc.NdefMessage[]"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="target" type="java.lang.String">
</parameter>
</method>
<method name="getNdefTargets"
 return="java.lang.String[]"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<field name="CREATOR"
 type="android.os.Parcelable.Creator"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_MIFARE_CLASSIC"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;type_mifare_classic&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_OTHER"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;other&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_TYPE_1"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;type_1&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_TYPE_2"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;type_2&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_TYPE_3"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;type_3&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_TYPE_4"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;type_4&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="NdefTagConnection"
 extends="android.nfc.RawTagConnection"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="getModeHint"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="makeReadOnly"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="readNdefMessages"
 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="writeNdefMessage"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="message" type="android.nfc.NdefMessage">
</parameter>
<exception name="FormatException" type="android.nfc.FormatException">
</exception>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<field name="NDEF_MODE_READ_ONCE"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NDEF_MODE_READ_ONLY"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NDEF_MODE_UNKNOWN"
 type="int"
 transient="false"
 volatile="false"
 value="5"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NDEF_MODE_WRITE_MANY"
 type="int"
 transient="false"
 volatile="false"
 value="4"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NDEF_MODE_WRITE_ONCE"
 type="int"
 transient="false"
 volatile="false"
 value="3"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="NfcAdapter"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<method name="createNdefTagConnection"
 return="android.nfc.NdefTagConnection"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="tag" type="android.nfc.NdefTag">
</parameter>
</method>
<method name="createNdefTagConnection"
 return="android.nfc.NdefTagConnection"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="tag" type="android.nfc.NdefTag">
</parameter>
<parameter name="target" type="java.lang.String">
</parameter>
</method>
<method name="createRawTagConnection"
 return="android.nfc.RawTagConnection"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="tag" type="android.nfc.Tag">
</parameter>
</method>
<method name="createRawTagConnection"
 return="android.nfc.RawTagConnection"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="tag" type="android.nfc.Tag">
</parameter>
<parameter name="target" type="java.lang.String">
</parameter>
</method>
<method name="getDefaultAdapter"
 return="android.nfc.NfcAdapter"
 abstract="false"
 native="false"
 synchronized="false"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getLocalNdefMessage"
 return="android.nfc.NdefMessage"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="isTagDiscoveryEnabled"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="setLocalNdefMessage"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="message" type="android.nfc.NdefMessage">
</parameter>
</method>
<field name="ACTION_NDEF_TAG_DISCOVERED"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.nfc.action.NDEF_TAG_DISCOVERED&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ACTION_TAG_DISCOVERED"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.nfc.action.TAG_DISCOVERED&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="EXTRA_TAG"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.nfc.extra.TAG&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="RawTagConnection"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="close"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="connect"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="getTag"
 return="android.nfc.Tag"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getTagTarget"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="isConnected"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</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="Tag"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.os.Parcelable">
</implements>
<method name="describeContents"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getId"
 return="byte[]"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getRawTargets"
 return="java.lang.String[]"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="writeToParcel"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="dest" type="android.os.Parcel">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<field name="CREATOR"
 type="android.os.Parcelable.Creator"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_ISO_14443_3A"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;iso14443_3a&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_ISO_14443_3B"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;iso14443_3b&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_ISO_14443_3B_PRIME"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;iso14443_3b&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_ISO_14443_4"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;iso14443_4&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_ISO_15693"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;iso15693&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_JIS_X_6319_4"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;jis_x_6319_4&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_OTHER"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;other&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TARGET_TOPAZ"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;topaz&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
</package>
<package name="android.opengl"
>
+0 −21
Original line number Diff line number Diff line
@@ -102,9 +102,6 @@ import android.view.inputmethod.InputMethodManager;
import android.accounts.AccountManager;
import android.accounts.IAccountManager;
import android.app.admin.DevicePolicyManager;
import com.trustedlogic.trustednfc.android.NfcManager;
import com.trustedlogic.trustednfc.android.INfcManager;

import com.android.internal.os.IDropBoxManagerService;

import java.io.File;
@@ -173,7 +170,6 @@ class ContextImpl extends Context {
    private static ThrottleManager sThrottleManager;
    private static WifiManager sWifiManager;
    private static LocationManager sLocationManager;
    private static NfcManager sNfcManager;
    private static final HashMap<String, SharedPreferencesImpl> sSharedPrefs =
            new HashMap<String, SharedPreferencesImpl>();

@@ -972,8 +968,6 @@ class ContextImpl extends Context {
            return getClipboardManager();
        } else if (WALLPAPER_SERVICE.equals(name)) {
            return getWallpaperManager();
        } else if (NFC_SERVICE.equals(name)) {
            return getNfcManager();
        } else if (DROPBOX_SERVICE.equals(name)) {
            return getDropBoxManager();
        } else if (DEVICE_POLICY_SERVICE.equals(name)) {
@@ -1209,21 +1203,6 @@ class ContextImpl extends Context {
        return mDownloadManager;
    }

    private NfcManager getNfcManager()
    {
        synchronized (sSync) {
            if (sNfcManager == null) {
                IBinder b = ServiceManager.getService(NFC_SERVICE);
                if (b == null) {
                    return null;
                }
                INfcManager service = INfcManager.Stub.asInterface(b);
                sNfcManager = new NfcManager(service, mMainThread.getHandler());
            }
        }
        return sNfcManager;
    }

    @Override
    public int checkPermission(String permission, int pid, int uid) {
        if (permission == null) {
+18 −29
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 The Android Open Source Project
 * Copyright (C) 2010, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,13 +14,7 @@
 * limitations under the License.
 */

/**
 * File            : ErrorCodes.java
 * Original-Author : Trusted Logic S.A. (Sylvain Fonteneau)
 * Created         : 26-02-2010
 */

package com.trustedlogic.trustednfc.android.internal;
package android.nfc;

/**
 * This class defines all the error codes that can be returned by the service
@@ -83,9 +77,4 @@ public class ErrorCodes {

    public static final int ERROR_NO_SE_CONNECTED = -20;

    
    
    
    
    
}
 No newline at end of file
Loading