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>
This commit is contained in:
Nick Pelly
2010-10-13 17:25:24 -07:00
parent dbb78f0e4e
commit cd0e839a24
19 changed files with 344 additions and 3012 deletions

View File

@@ -20,7 +20,6 @@ import com.android.server.am.ActivityManagerService;
import com.android.internal.app.ShutdownThread;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.SamplingProfilerIntegration;
import com.trustedlogic.trustednfc.android.server.NfcService;
import dalvik.system.VMRuntime;
import dalvik.system.Zygote;
@@ -440,20 +439,6 @@ class ServerThread extends Thread {
Slog.e(TAG, "Failure starting Recognition Service", e);
}
try {
Slog.i(TAG, "Nfc Service");
NfcService nfc;
try {
nfc = new NfcService(context);
} catch (UnsatisfiedLinkError e) { // gross hack to detect NFC
nfc = null;
Slog.w(TAG, "No NFC support");
}
ServiceManager.addService(Context.NFC_SERVICE, nfc);
} catch (Throwable e) {
Slog.e(TAG, "Failure starting NFC Service", e);
}
try {
Slog.i(TAG, "DiskStats Service");
ServiceManager.addService("diskstats", new DiskStatsService(context));