Skip to content

Commit

Permalink
Ensure that SecureNFC setting cannot be bypassed
Browse files Browse the repository at this point in the history
Bug: 268038643
Test: ctsverifier
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6cb53d963d376b97963120a4d2c7df961789e428)
Merged-In: I53a45c3600dc6bba7009921ca5135ee37b5edfd0
Change-Id: I53a45c3600dc6bba7009921ca5135ee37b5edfd0
  • Loading branch information
Alisher Alikhodjaev authored and thestinger committed Sep 6, 2023
1 parent 089288d commit 27e7cdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/com/android/nfc/NfcService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,12 @@ void enforceBeamShareActivityPolicy(Context context, UserHandle uh) {
}
}

public boolean isSecureNfcEnabled() {
synchronized (NfcService.this) {
return mIsSecureNfcEnabled;
}
}

final class NfcAdapterService extends INfcAdapter.Stub {
@Override
public boolean enable() throws RemoteException {
Expand Down
4 changes: 3 additions & 1 deletion src/com/android/nfc/cardemulation/HostEmulationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ public void onHostEmulationData(byte[] data) {
// Resolve to default
// Check if resolvedService requires unlock
ApduServiceInfo defaultServiceInfo = resolveInfo.defaultService;
if (defaultServiceInfo.requiresUnlock() && mKeyguard.isKeyguardLocked()) {
if ((defaultServiceInfo.requiresUnlock()
|| NfcService.getInstance().isSecureNfcEnabled())
&& mKeyguard.isKeyguardLocked()) {
NfcService.getInstance().sendRequireUnlockIntent();
NfcService.getInstance().sendData(AID_NOT_FOUND);
if (DBG) Log.d(TAG, "requiresUnlock()! show toast");
Expand Down

0 comments on commit 27e7cdc

Please sign in to comment.