diff options
author | Andres Morales <anmorales@google.com> | 2014-11-12 09:06:35 -0800 |
---|---|---|
committer | Andres Morales <anmorales@google.com> | 2014-11-19 09:56:31 -0800 |
commit | 31b0f4653686119d74876cae5d637c5baf52b935 (patch) | |
tree | c9052eb4a9a9543c9456e6ed06129547bb0c5639 /nci | |
parent | eebaf6f543d8b8983b2b0dce29812d2d2329424f (diff) | |
download | android_packages_apps_Nfc-31b0f4653686119d74876cae5d637c5baf52b935.tar.gz android_packages_apps_Nfc-31b0f4653686119d74876cae5d637c5baf52b935.tar.bz2 android_packages_apps_Nfc-31b0f4653686119d74876cae5d637c5baf52b935.zip |
Prevent Beam at the lockscreen and during provisioning
Since we can poll at the lockscreen not for unlock
tags, need to explicitly disable Beam.
Also since we allow peripheral handover during provisioning,
we started allowing Beam as well. Blocking that.
Bug: 18349433
Change-Id: I987f43228d2c003c66201d2e91bd9bdfebd49d78
Diffstat (limited to 'nci')
-rwxr-xr-x | nci/jni/NativeNfcManager.cpp | 20 | ||||
-rwxr-xr-x | nci/src/com/android/nfc/dhimpl/NativeNfcManager.java | 4 |
2 files changed, 17 insertions, 7 deletions
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp index 5001ee7e..98e243a1 100755 --- a/nci/jni/NativeNfcManager.cpp +++ b/nci/jni/NativeNfcManager.cpp @@ -122,6 +122,7 @@ static bool sIsDisabling = false; static bool sRfEnabled = false; // whether RF discovery is enabled static bool sSeRfActive = false; // whether RF with SE is likely active static bool sReaderModeEnabled = false; // whether we're only reading tags, not allowing P2p/card emu +static bool sP2pEnabled = false; static bool sP2pActive = false; // whether p2p was last active static bool sAbortConnlessWait = false; #define CONFIG_UPDATE_TECH_MASK (1 << 1) @@ -930,7 +931,7 @@ TheEnd: ** *******************************************************************************/ static void nfcManager_enableDiscovery (JNIEnv* e, jobject o, jint technologies_mask, \ - jboolean enable_lptd, jboolean reader_mode, jboolean enable_host_routing, + jboolean enable_lptd, jboolean reader_mode, jboolean enable_host_routing, jboolean enable_p2p, jboolean restart) { tNFA_TECHNOLOGY_MASK tech_mask = DEFAULT_TECH_MASK; @@ -968,20 +969,27 @@ static void nfcManager_enableDiscovery (JNIEnv* e, jobject o, jint technologies_ if (sPollingEnabled) { ALOGD ("%s: Enable p2pListening", __FUNCTION__); - PeerToPeer::getInstance().enableP2pListening (!reader_mode); + + if (enable_p2p && !sP2pEnabled) { + sP2pEnabled = true; + PeerToPeer::getInstance().enableP2pListening (true); + NFA_ResumeP2p(); + } else if (!enable_p2p && sP2pEnabled) { + sP2pEnabled = false; + PeerToPeer::getInstance().enableP2pListening (false); + NFA_PauseP2p(); + } if (reader_mode && !sReaderModeEnabled) { sReaderModeEnabled = true; - NFA_PauseP2p(); NFA_DisableListening(); NFA_SetRfDiscoveryDuration(READER_MODE_DISCOVERY_DURATION); } - else if (sReaderModeEnabled) + else if (!reader_mode && sReaderModeEnabled) { struct nfc_jni_native_data *nat = getNative(e, o); sReaderModeEnabled = false; - NFA_ResumeP2p(); NFA_EnableListening(); NFA_SetRfDiscoveryDuration(nat->discovery_duration); } @@ -1616,7 +1624,7 @@ static JNINativeMethod gMethods[] = {"commitRouting", "()Z", (void*) nfcManager_commitRouting}, - {"doEnableDiscovery", "(IZZZZ)V", + {"doEnableDiscovery", "(IZZZZZ)V", (void*) nfcManager_enableDiscovery}, {"doCheckLlcp", "()Z", diff --git a/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java b/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java index d327f62a..99ee5d52 100755 --- a/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java +++ b/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java @@ -102,11 +102,13 @@ public class NativeNfcManager implements DeviceHost { boolean enableLowPowerPolling, boolean enableReaderMode, boolean enableHostRouting, + boolean enableP2p, boolean restart); @Override public void enableDiscovery(NfcDiscoveryParameters params, boolean restart) { doEnableDiscovery(params.getTechMask(), params.shouldEnableLowPowerDiscovery(), - params.shouldEnableReaderMode(), params.shouldEnableHostRouting(), restart); + params.shouldEnableReaderMode(), params.shouldEnableHostRouting(), + params.shouldEnableP2p(), restart); } @Override |