diff options
author | Martijn Coenen <maco@google.com> | 2016-05-23 09:13:57 +0200 |
---|---|---|
committer | Jessica Wagantall <jwagantall@cyngn.com> | 2016-07-08 13:39:03 -0700 |
commit | 7ba6f20cdff93a307f1c8b9a793102006da4a198 (patch) | |
tree | 9ce55398a856b0131c255ee96ad349297e6a1179 | |
parent | 3eabe22cbaf7190dde7a3f0eba0d6d2c9b42e078 (diff) | |
download | android_packages_apps_Nfc-stable/cm-12.1-YOG7D.tar.gz android_packages_apps_Nfc-stable/cm-12.1-YOG7D.tar.bz2 android_packages_apps_Nfc-stable/cm-12.1-YOG7D.zip |
Verify setForegroundDispatch caller is in foreground.stable/cm-12.1-YOG7D
Bug: 28300969
CYNGNOS-3020
Change-Id: Icadfe70cd06f921badd266e7a4efbae15a8c206a
(cherry picked from commit 0889ac84bd8325b41583033ac7597e020fd24600)
-rwxr-xr-x | src/com/android/nfc/NfcService.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index 0f3feedc..153a650d 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -815,7 +815,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); @@ -945,6 +948,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 (flags != 0) { try { |