From 7ea5c45e8d89f59065f088d4e11cceeeed9d64d1 Mon Sep 17 00:00:00 2001 From: Nick Pelly Date: Wed, 20 Oct 2010 18:39:11 -0700 Subject: NFC settings cleanup. Remove NFC settings from Settings.System. The NFC Service tracks them internally using SharedPreference. Revert back to enable()/disable()/isEnabled() - Tag discovery is the only functionality NFC service performs right now so we don't need to break it up more explicitly yet. enable/disable is the global NFC on/off and later we'll add enableDiscovery(), enableTagEmulation(), enableSecureElement() etc as needed. Change-Id: Id5b23e89d4a29511835f509962842452075e56cb Signed-off-by: Nick Pelly --- core/java/android/nfc/NfcAdapter.java | 17 ++++-- core/java/android/provider/Settings.java | 92 -------------------------------- 2 files changed, 13 insertions(+), 96 deletions(-) (limited to 'core') diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java index bc3c6d9..6884abb 100644 --- a/core/java/android/nfc/NfcAdapter.java +++ b/core/java/android/nfc/NfcAdapter.java @@ -227,14 +227,17 @@ public final class NfcAdapter { } /** - * Return true if this NFC Adapter is enabled to discover new tags. + * Return true if this NFC Adapter has any features enabled. *

* If this method returns false, then applications should request the user * turn on NFC tag discovery in Settings. + *

+ * If this method returns false, the NFC hardware is guaranteed not to + * perform or respond to any NFC communication. * * @return true if this NFC Adapter is enabled to discover new tags */ - public boolean isTagDiscoveryEnabled() { + public boolean isEnabled() { try { return mService.isEnabled(); } catch (RemoteException e) { @@ -244,12 +247,14 @@ public final class NfcAdapter { } /** + * Enable NFC hardware. + *

* NOTE: may block for ~second or more. Poor API. Avoid * calling from the UI thread. * * @hide */ - public boolean enableTagDiscovery() { + public boolean enable() { try { return mService.enable(); } catch (RemoteException e) { @@ -259,12 +264,16 @@ public final class NfcAdapter { } /** + * Disable NFC hardware. + * No NFC features will work after this call, and the hardware + * will not perform or respond to any NFC communication. + *

* NOTE: may block for ~second or more. Poor API. Avoid * calling from the UI thread. * * @hide */ - public boolean disableTagDiscovery() { + public boolean disable() { try { return mService.disable(); } catch (RemoteException e) { diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 90cd840..5aa22fb 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1640,86 +1640,6 @@ public final class Settings { public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; /** - * Whether nfc is enabled/disabled - * 0=disabled. 1=enabled. - * @hide - */ - public static final String NFC_ON = "nfc_on"; - - /** - * Whether nfc secure element is enabled/disabled - * 0=disabled. 1=enabled. - * @hide - */ - public static final String NFC_SECURE_ELEMENT_ON = "nfc_secure_element_on"; - - /** - * Whether nfc secure element is enabled/disabled - * 0=disabled. 1=enabled. - * @hide - */ - public static final String NFC_SECURE_ELEMENT_ID = "nfc_secure_element_id"; - - /** - * LLCP LTO value - * @hide - */ - public static final String NFC_LLCP_LTO = "nfc_llcp_lto"; - - /** - * LLCP MIU value - * @hide - */ - public static final String NFC_LLCP_MIU = "nfc_llcp_miu"; - - /** - * LLCP WKS value - * @hide - */ - public static final String NFC_LLCP_WKS = "nfc_llcp_wks"; - - /** - * LLCP OPT value - * @hide - */ - public static final String NFC_LLCP_OPT = "nfc_llcp_opt"; - - /** - * NFC Discovery Reader A - * 0=disabled. 1=enabled. - * @hide - */ - public static final String NFC_DISCOVERY_A = "nfc_discovery_a"; - - /** - * NFC Discovery Reader B - * 0=disabled. 1=enabled. - * @hide - */ - public static final String NFC_DISCOVERY_B = "nfc_discovery_b"; - - /** - * NFC Discovery Reader Felica - * 0=disabled. 1=enabled. - * @hide - */ - public static final String NFC_DISCOVERY_F = "nfc_discovery_felica"; - - /** - * NFC Discovery Reader 15693 - * 0=disabled. 1=enabled. - * @hide - */ - public static final String NFC_DISCOVERY_15693 = "nfc_discovery_15693"; - - /** - * NFC Discovery NFCIP - * 0=disabled. 1=enabled. - * @hide - */ - public static final String NFC_DISCOVERY_NFCIP = "nfc_discovery_nfcip"; - - /** * Show pointer location on screen? * 0 = no * 1 = yes @@ -1885,18 +1805,6 @@ public final class Settings { NOTIFICATION_LIGHT_PULSE, SIP_CALL_OPTIONS, SIP_RECEIVE_CALLS, - NFC_ON, - NFC_SECURE_ELEMENT_ON, - NFC_SECURE_ELEMENT_ID, - NFC_LLCP_LTO, - NFC_LLCP_MIU, - NFC_LLCP_WKS, - NFC_LLCP_OPT, - NFC_DISCOVERY_A, - NFC_DISCOVERY_B, - NFC_DISCOVERY_F, - NFC_DISCOVERY_15693, - NFC_DISCOVERY_NFCIP, }; // Settings moved to Settings.Secure -- cgit v1.1