merge in nyc-release history after reset to nyc-dev
diff --git a/src/com/android/nfc/NfcDispatcher.java b/src/com/android/nfc/NfcDispatcher.java
index 45a6b38..ff86d6a 100644
--- a/src/com/android/nfc/NfcDispatcher.java
+++ b/src/com/android/nfc/NfcDispatcher.java
@@ -272,6 +272,16 @@
return screenUnlocked ? DISPATCH_UNLOCK : DISPATCH_SUCCESS;
}
+ if (tryPeripheralHandover(message)) {
+ if (DBG) Log.i(TAG, "matched BT HANDOVER");
+ return screenUnlocked ? DISPATCH_UNLOCK : DISPATCH_SUCCESS;
+ }
+
+ if (NfcWifiProtectedSetup.tryNfcWifiSetup(ndef, mContext)) {
+ if (DBG) Log.i(TAG, "matched NFC WPS TOKEN");
+ return screenUnlocked ? DISPATCH_UNLOCK : DISPATCH_SUCCESS;
+ }
+
if (provisioningOnly) {
if (message == null) {
// We only allow NDEF-message dispatch in provisioning mode
@@ -286,16 +296,6 @@
}
}
- if (tryPeripheralHandover(message)) {
- if (DBG) Log.i(TAG, "matched BT HANDOVER");
- return screenUnlocked ? DISPATCH_UNLOCK : DISPATCH_SUCCESS;
- }
-
- if (NfcWifiProtectedSetup.tryNfcWifiSetup(ndef, mContext)) {
- if (DBG) Log.i(TAG, "matched NFC WPS TOKEN");
- return screenUnlocked ? DISPATCH_UNLOCK : DISPATCH_SUCCESS;
- }
-
if (tryNdef(dispatch, message)) {
return screenUnlocked ? DISPATCH_UNLOCK : DISPATCH_SUCCESS;
}
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index a5aa89a..8411fb6 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -962,8 +962,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) {