Commit 9ea802b5 authored by Martijn Coenen's avatar Martijn Coenen Committed by The Android Automerger
Browse files

Verify setForegroundDispatch caller is in foreground.

Bug: 28300969
Change-Id: Icadfe70cd06f921badd266e7a4efbae15a8c206a
parent 8d04aeed
......@@ -805,7 +805,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);
......@@ -935,6 +938,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.");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment