NFC: Move NFC service implementation out of system_server.

NFC service is now an application service in packages/apps/Nfc.

NFC service is registered through ServiceManager.addService(), and the proxy
object NfcAdapter obtains a handle to it through ServiceManager.getService().

**Important** Had to add new symbols AID_NFC / NFC_UID / android.uid.nfc and
modify service_manager.c, Process.java and PackageManagerService.java in order
to force the com.android.nfc process to take a fixed uid, so that it can use
ServiceManager.addService().

Most of the JNI has moved to packages/apps/Nfc/jni. However NdefRecord and
NdefMessage require some in-process native code, so android_com_NdefMessage.cpp
and android_com_NdefRecord.cpp stay in frameworks/base/core/jni. They link to
a very small library libnfc_ndef.so that implements NDEF message parsing. This
has been added to core.mk so all devices (even without NFC hardware) can work
with NDEF data.

Bug: 3041259
Bug: 3097445
Change-Id: If7f00cd8f2053acfc9319ca366d4a9c02bd396e6
Signed-off-by: Nick Pelly <npelly@google.com>
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index a4a1a70..c38e001 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -127,6 +127,8 @@
 extern int register_android_database_SQLiteStatement(JNIEnv* env);
 extern int register_android_debug_JNITest(JNIEnv* env);
 extern int register_android_nio_utils(JNIEnv* env);
+extern int register_android_nfc_NdefMessage(JNIEnv *env);
+extern int register_android_nfc_NdefRecord(JNIEnv *env);
 extern int register_android_pim_EventRecurrence(JNIEnv* env);
 extern int register_android_text_format_Time(JNIEnv* env);
 extern int register_android_os_Debug(JNIEnv* env);
@@ -170,18 +172,6 @@
 extern int register_android_content_res_ObbScanner(JNIEnv* env);
 extern int register_android_content_res_Configuration(JNIEnv* env);
 
-#ifdef HAVE_NFC
-extern int register_com_trustedlogic_trustednfc_android_internal_NativeNfcManager(JNIEnv *env);
-extern int register_com_trustedlogic_trustednfc_android_internal_NativeNfcTag(JNIEnv *env);
-extern int register_com_trustedlogic_trustednfc_android_internal_NativeNdefTag(JNIEnv *env);
-extern int register_com_trustedlogic_trustednfc_android_NdefMessage(JNIEnv *env);
-extern int register_com_trustedlogic_trustednfc_android_NdefRecord(JNIEnv *env);
-extern int register_com_trustedlogic_trustednfc_android_internal_NativeP2pDevice(JNIEnv *env);
-extern int register_com_trustedlogic_trustednfc_android_internal_NativeLlcpSocket(JNIEnv *env);
-extern int register_com_trustedlogic_trustednfc_android_internal_NativeLlcpConnectionlessSocket(JNIEnv *env);
-extern int register_com_trustedlogic_trustednfc_android_internal_NativeLlcpServiceSocket(JNIEnv *env);
-#endif
-
 static AndroidRuntime* gCurRuntime = NULL;
 
 static void doThrow(JNIEnv* env, const char* exc, const char* msg = NULL)
@@ -1266,6 +1256,8 @@
     REG_JNI(register_android_net_NetworkUtils),
     REG_JNI(register_android_net_TrafficStats),
     REG_JNI(register_android_net_wifi_WifiManager),
+    REG_JNI(register_android_nfc_NdefMessage),
+    REG_JNI(register_android_nfc_NdefRecord),
     REG_JNI(register_android_os_MemoryFile),
     REG_JNI(register_com_android_internal_os_ZygoteInit),
     REG_JNI(register_android_hardware_Camera),
@@ -1299,18 +1291,6 @@
 
     REG_JNI(register_android_content_res_ObbScanner),
     REG_JNI(register_android_content_res_Configuration),
-
-#ifdef HAVE_NFC
-    REG_JNI(register_com_trustedlogic_trustednfc_android_internal_NativeNfcManager),
-    REG_JNI(register_com_trustedlogic_trustednfc_android_internal_NativeNfcTag),
-    REG_JNI(register_com_trustedlogic_trustednfc_android_internal_NativeNdefTag),
-    REG_JNI(register_com_trustedlogic_trustednfc_android_NdefMessage),
-    REG_JNI(register_com_trustedlogic_trustednfc_android_NdefRecord),
-    REG_JNI(register_com_trustedlogic_trustednfc_android_internal_NativeP2pDevice),
-    REG_JNI(register_com_trustedlogic_trustednfc_android_internal_NativeLlcpSocket),
-    REG_JNI(register_com_trustedlogic_trustednfc_android_internal_NativeLlcpConnectionlessSocket),
-    REG_JNI(register_com_trustedlogic_trustednfc_android_internal_NativeLlcpServiceSocket),
-#endif
 };
 
 /*