commit | dfb72489b69fdac4df4e27e6fe4277e4ea398e64 | [log] [tgz] |
---|---|---|
author | Alisher Alikhodjaev <alisher@google.com> | Wed May 10 18:27:42 2023 -0700 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Sep 01 12:05:45 2023 +0000 |
tree | 3e5190cb220c9ed298de3874b11a0579ddf9d5c0 | |
parent | 4bb0b6b97a2ba7aa181e9417221f90060fb1117f [diff] |
Ensure that SecureNFC setting cannot be bypassed Bug: 268038643 Test: ctsverifier (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6cb53d963d376b97963120a4d2c7df961789e428) Merged-In: I53a45c3600dc6bba7009921ca5135ee37b5edfd0 Change-Id: I53a45c3600dc6bba7009921ca5135ee37b5edfd0
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index 7e99b8b..edbdda9 100644 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java
@@ -1166,6 +1166,12 @@ } } + public boolean isSecureNfcEnabled() { + synchronized (NfcService.this) { + return mIsSecureNfcEnabled; + } + } + final class NfcAdapterService extends INfcAdapter.Stub { @Override public boolean enable() throws RemoteException {
diff --git a/src/com/android/nfc/cardemulation/HostEmulationManager.java b/src/com/android/nfc/cardemulation/HostEmulationManager.java index 8146202..8849cca 100644 --- a/src/com/android/nfc/cardemulation/HostEmulationManager.java +++ b/src/com/android/nfc/cardemulation/HostEmulationManager.java
@@ -188,7 +188,9 @@ // 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");