Merge changes from topics "Deprecate-android-beam", "Dynamic_Default_Aid_Route"
* changes:
Remove NFC LiveCase functionality
Start P2P services only if Android Beam is supported
Add routing mechanism for NFC CE
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index c8d6b55..77d31cc 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -28,7 +28,6 @@
#include "NfcJniUtil.h"
#include "NfcTag.h"
#include "PeerToPeer.h"
-#include "Pn544Interop.h"
#include "PowerSwitch.h"
#include "RoutingManager.h"
#include "SyncEvent.h"
@@ -380,7 +379,7 @@
__func__);
}
}
- } else if (pn544InteropIsBusy() == false) {
+ } else {
NfcTag::getInstance().connectionEventHandler(connEvent, eventData);
// We know it is not activating for P2P. If it activated in
@@ -1253,7 +1252,6 @@
tNFA_STATUS status = NFA_STATUS_OK;
DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter;", __func__);
- pn544InteropAbortNow();
if (sDiscoveryEnabled == false) {
DLOG_IF(INFO, nfc_debug_enabled)
<< StringPrintf("%s: already disabled", __func__);
@@ -1394,7 +1392,6 @@
sIsDisabling = true;
- pn544InteropAbortNow();
RoutingManager::getInstance().onNfccShutdown();
PowerSwitch::getInstance().initialize(PowerSwitch::UNKNOWN_LEVEL);
HciEventManager::getInstance().finalize();
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index 4b815aa..7f7727d 100644
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -30,7 +30,6 @@
#include "Mutex.h"
#include "NfcJniUtil.h"
#include "NfcTag.h"
-#include "Pn544Interop.h"
#include "ndef_utils.h"
#include "nfa_api.h"
@@ -1218,10 +1217,6 @@
ndef[1] = NDEF_MODE_READ_WRITE;
e->ReleaseIntArrayElements(ndefInfo, ndef, 0);
status = NFA_STATUS_FAILED;
- } else if ((sCheckNdefStatus == NFA_STATUS_TIMEOUT) &&
- (NfcTag::getInstance().getProtocol() == NFC_PROTOCOL_ISO_DEP)) {
- pn544InteropStopPolling();
- status = sCheckNdefStatus;
} else {
DLOG_IF(INFO, nfc_debug_enabled)
<< StringPrintf("%s: unknown status 0x%X", __func__, sCheckNdefStatus);
diff --git a/nci/jni/Pn544Interop.cpp b/nci/jni/Pn544Interop.cpp
deleted file mode 100644
index 6d89056..0000000
--- a/nci/jni/Pn544Interop.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*****************************************************************************
-**
-** Description: Implement operations that provide compatibility with NXP
-** PN544 controller. Specifically facilitate peer-to-peer
-** operations with PN544 controller.
-**
-*****************************************************************************/
-#include "Pn544Interop.h"
-#include "IntervalTimer.h"
-#include "Mutex.h"
-#include "NfcTag.h"
-
-#include <android-base/stringprintf.h>
-#include <base/logging.h>
-
-using android::base::StringPrintf;
-
-extern bool nfc_debug_enabled;
-
-namespace android {
-extern void startStopPolling(bool isStartPolling);
-}
-
-/*****************************************************************************
-**
-** private variables and functions
-**
-*****************************************************************************/
-
-static const int gIntervalTime =
- 1000; // millisecond between the check to restore polling
-static IntervalTimer gTimer;
-static Mutex gMutex;
-static void pn544InteropStartPolling(
- union sigval); // callback function for interval timer
-static bool gIsBusy = false; // is timer busy?
-static bool gAbortNow = false; // stop timer during next callback
-
-/*******************************************************************************
-**
-** Function: pn544InteropStopPolling
-**
-** Description: Stop polling to let NXP PN544 controller poll.
-** PN544 should activate in P2P mode.
-**
-** Returns: None
-**
-*******************************************************************************/
-void pn544InteropStopPolling() {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
- gMutex.lock();
- gTimer.kill();
- android::startStopPolling(false);
- gIsBusy = true;
- gAbortNow = false;
- gTimer.set(gIntervalTime,
- pn544InteropStartPolling); // after some time, start polling again
- gMutex.unlock();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
-}
-
-/*******************************************************************************
-**
-** Function: pn544InteropStartPolling
-**
-** Description: Start polling when activation state is idle.
-** sigval: Unused.
-**
-** Returns: None
-**
-*******************************************************************************/
-void pn544InteropStartPolling(union sigval) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
- gMutex.lock();
- NfcTag::ActivationState state = NfcTag::getInstance().getActivationState();
-
- if (gAbortNow) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: abort now", __func__);
- gIsBusy = false;
- goto TheEnd;
- }
-
- if (state == NfcTag::Idle) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: start polling", __func__);
- android::startStopPolling(true);
- gIsBusy = false;
- } else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: try again later", __func__);
- gTimer.set(
- gIntervalTime,
- pn544InteropStartPolling); // after some time, start polling again
- }
-
-TheEnd:
- gMutex.unlock();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
-}
-
-/*******************************************************************************
-**
-** Function: pn544InteropIsBusy
-**
-** Description: Is the code performing operations?
-**
-** Returns: True if the code is busy.
-**
-*******************************************************************************/
-bool pn544InteropIsBusy() {
- bool isBusy = false;
- gMutex.lock();
- isBusy = gIsBusy;
- gMutex.unlock();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: %u", __func__, isBusy);
- return isBusy;
-}
-
-/*******************************************************************************
-**
-** Function: pn544InteropAbortNow
-**
-** Description: Request to abort all operations.
-**
-** Returns: None.
-**
-*******************************************************************************/
-void pn544InteropAbortNow() {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
- gMutex.lock();
- gAbortNow = true;
- gMutex.unlock();
-}
diff --git a/nci/jni/Pn544Interop.h b/nci/jni/Pn544Interop.h
deleted file mode 100644
index 3d1bc20..0000000
--- a/nci/jni/Pn544Interop.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*****************************************************************************
-**
-** Description: Implement operations that provide compatibility with NXP
-** PN544 controller. Specifically facilitate peer-to-peer
-** operations with PN544 controller.
-**
-*****************************************************************************/
-#pragma once
-#include "NfcJniUtil.h"
-
-/*******************************************************************************
-**
-** Function: pn544InteropStopPolling
-**
-** Description: Stop polling to let NXP PN544 controller poll.
-** PN544 should activate in P2P mode.
-**
-** Returns: None
-**
-*******************************************************************************/
-void pn544InteropStopPolling();
-
-/*******************************************************************************
-**
-** Function: pn544InteropIsBusy
-**
-** Description: Is the code performing operations?
-**
-** Returns: True if the code is busy.
-**
-*******************************************************************************/
-bool pn544InteropIsBusy();
-
-/*******************************************************************************
-**
-** Function: pn544InteropAbortNow
-**
-** Description: Request to abort all operations.
-**
-** Returns: None.
-**
-*******************************************************************************/
-void pn544InteropAbortNow();