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:00 -0700 |
commit | 2897656914b8c8e9547b89c04202470eb3044b4b (patch) | |
tree | afa1106499dff8947a3caf82237b7e6fc4f1d240 | |
parent | 90cafd37247b19745126ae8f26096a01a20a624c (diff) | |
download | android_packages_apps_Nfc-2897656914b8c8e9547b89c04202470eb3044b4b.tar.gz android_packages_apps_Nfc-2897656914b8c8e9547b89c04202470eb3044b4b.tar.bz2 android_packages_apps_Nfc-2897656914b8c8e9547b89c04202470eb3044b4b.zip |
Verify setForegroundDispatch caller is in foreground.stable/cm-12.1-YOG4P
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 { |