summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2016-05-24 20:57:01 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-24 20:57:01 +0000
commit9425f5d4caafc1c92fa1ff6ea3a65538ec7f5486 (patch)
tree00281f8383e2d6f62fbd7d38cbefcc44eddf0939
parent4a64287d5521030ea9c48ac9abf15483730bd806 (diff)
parentf164556dc9795b716ba6cf8f748a18ebcaa0a149 (diff)
downloadandroid_packages_apps_Nfc-9425f5d4caafc1c92fa1ff6ea3a65538ec7f5486.tar.gz
android_packages_apps_Nfc-9425f5d4caafc1c92fa1ff6ea3a65538ec7f5486.tar.bz2
android_packages_apps_Nfc-9425f5d4caafc1c92fa1ff6ea3a65538ec7f5486.zip
Merge "Verify setForegroundDispatch caller is in foreground." into nyc-dev
am: f164556dc9 * commit 'f164556dc9795b716ba6cf8f748a18ebcaa0a149': Verify setForegroundDispatch caller is in foreground. Change-Id: I3852274a754d83c374df0717a0763e618c28cc70
-rwxr-xr-xsrc/com/android/nfc/NfcService.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 9662ac36..a5aa89a6 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -793,7 +793,10 @@ public class NfcService implements DeviceHostListener {
public void setForegroundDispatch(PendingIntent intent,
IntentFilter[] filters, TechListParcel techListsParcel) {
NfcPermissions.enforceUserPermissions(mContext);
-
+ if (!mForegroundUtils.isInForeground(Binder.getCallingUid())) {
+ Log.e(TAG, "setForegroundDispatch: Caller not in foreground.");
+ return;
+ }
// Short-cut the disable path
if (intent == null && filters == null && techListsParcel == null) {
mNfcDispatcher.setForegroundDispatch(null, null, null);
@@ -959,6 +962,10 @@ public class NfcService implements DeviceHostListener {
@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.");
+ return;
+ }
synchronized (NfcService.this) {
if (!isNfcEnabled()) {
Log.e(TAG, "setReaderMode() called while NFC is not enabled.");