summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorAndroid Build Merger (Role) <noreply-android-build-merger@google.com>2019-01-29 07:01:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-01-29 07:01:49 +0000
commit9b314ceab090568feed1142c3f1761a73df47820 (patch)
tree83463e9e3b511fc14e6afb176f2f6a2ec6b72b63 /core/java/android
parent99cd4d4739e43a210fb3be4d8cbad2b830464e0e (diff)
parentd8c592703d558c3ddd821d9a3f65df69ed7c1a05 (diff)
Merge "Merge "Add Secure NFC functionality" am: 3ffdb26aa8 am: c538141c6d am: 32b84ede51"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/nfc/INfcAdapter.aidl4
-rw-r--r--core/java/android/nfc/NfcAdapter.java57
2 files changed, 61 insertions, 0 deletions
diff --git a/core/java/android/nfc/INfcAdapter.aidl b/core/java/android/nfc/INfcAdapter.aidl
index 6801618e6a68..0b2cfdd9ece3 100644
--- a/core/java/android/nfc/INfcAdapter.aidl
+++ b/core/java/android/nfc/INfcAdapter.aidl
@@ -68,4 +68,8 @@ interface INfcAdapter
void removeNfcUnlockHandler(INfcUnlockHandler unlockHandler);
void verifyNfcPermission();
+ boolean isNfcSecureEnabled();
+ boolean deviceSupportsNfcSecure();
+ boolean setNfcSecure(boolean enable);
+
}
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index e55e0364f5d4..a7d2ee98b45c 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -1702,6 +1702,63 @@ public final class NfcAdapter {
}
/**
+ * Sets Secure NFC feature.
+ * <p>This API is for the Settings application.
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
+ public boolean setNfcSecure(boolean enable) {
+ if (!sHasNfcFeature) {
+ throw new UnsupportedOperationException();
+ }
+ try {
+ return sService.setNfcSecure(enable);
+ } catch (RemoteException e) {
+ attemptDeadServiceRecovery(e);
+ return false;
+ }
+ }
+
+ /**
+ * Checks if the device supports Secure NFC functionality.
+ *
+ * @return True if device supports Secure NFC, false otherwise
+ * @throws UnsupportedOperationException if FEATURE_NFC is unavailable.
+ */
+ public boolean deviceSupportsNfcSecure() {
+ if (!sHasNfcFeature) {
+ throw new UnsupportedOperationException();
+ }
+ try {
+ return sService.deviceSupportsNfcSecure();
+ } catch (RemoteException e) {
+ attemptDeadServiceRecovery(e);
+ return false;
+ }
+ }
+
+ /**
+ * Checks Secure NFC feature is enabled.
+ *
+ * @return True if device supports Secure NFC is enabled, false otherwise
+ * @throws UnsupportedOperationException if FEATURE_NFC is unavailable.
+ * @throws UnsupportedOperationException if device doesn't support
+ * Secure NFC functionality. {@link #deviceSupportsNfcSecure}
+ */
+ public boolean isNfcSecureEnabled() {
+ if (!sHasNfcFeature) {
+ throw new UnsupportedOperationException();
+ }
+ try {
+ return sService.isNfcSecureEnabled();
+ } catch (RemoteException e) {
+ attemptDeadServiceRecovery(e);
+ return false;
+ }
+ }
+
+ /**
* Enable NDEF Push feature.
* <p>This API is for the Settings application.
* @hide