Allow system_server access to NFC reader mode API.
Bug: 29451566
Change-Id: I26b0a2e9b33854efd59b95ab230a6db3042f93c7
(cherry picked from commit 8561f6480493802667fe186c11e7e03cc86a7183)
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index d62ec03..0be8bef 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -938,8 +938,9 @@
@Override
public void setReaderMode(IBinder binder, IAppCallback callback, int flags, Bundle extras)
throws RemoteException {
- if (!mForegroundUtils.isInForeground(Binder.getCallingUid())) {
- Log.e(TAG, "setReaderMode: Caller not in foreground.");
+ int callingUid = Binder.getCallingUid();
+ if (callingUid != Process.SYSTEM_UID && !mForegroundUtils.isInForeground(callingUid)) {
+ Log.e(TAG, "setReaderMode: Caller is not in foreground and is not system process.");
return;
}
synchronized (NfcService.this) {