aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornxpandroid <srikrishna.pramoda@nxp.com>2017-11-16 09:40:18 +0530
committernxpandroid <srikrishna.pramoda@nxp.com>2017-11-16 09:40:36 +0530
commit2747c62b9241ea83f94d19d488c15d64709b6cb8 (patch)
tree2335f78631391a8f6147d21eec56556cf06220b5
parent2af0fa35547ad20b5a2f33c8f2bfb7b73efc3b5d (diff)
downloadandroid_vendor_nxp_opensource_packages_apps_Nfc-2747c62b9241ea83f94d19d488c15d64709b6cb8.tar.gz
android_vendor_nxp_opensource_packages_apps_Nfc-2747c62b9241ea83f94d19d488c15d64709b6cb8.tar.bz2
android_vendor_nxp_opensource_packages_apps_Nfc-2747c62b9241ea83f94d19d488c15d64709b6cb8.zip
Fix for atr not working for conflict AID sent in screen lock state after selecting corresponding application
-rwxr-xr-xnci/jni/NativeNfcManager.cpp32
-rwxr-xr-xnci/jni/TransactionController.cpp18
-rwxr-xr-xnci/jni/TransactionController.h197
3 files changed, 144 insertions, 103 deletions
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index d15f7254..b2b95468 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -1639,7 +1639,17 @@ void nfaDeviceManagementCallback (uint8_t dmEvent, tNFA_DM_CBACK_DATA* eventData
}
else
{
- pTransactionController->transactionEnd(TRANSACTION_REQUESTOR(RF_FIELD_EVT));
+ /*In case of 66T/67T if Field On is not received before activation, consider NFA_ACTIVATED_EVENT for
+ locking the transaction and use Field Off received while removing the reader from proximity to end the lock*/
+ if(((nfcFL.chipType == pn548C2) || (nfcFL.chipType == pn551)) &&
+ pTransactionController->getCurTransactionRequestor() == TRANSACTION_REQUESTOR(NFA_ACTIVATED_EVENT))
+ {
+ pTransactionController->transactionEnd(TRANSACTION_REQUESTOR(NFA_ACTIVATED_EVENT));
+ }
+ else
+ {
+ pTransactionController->transactionEnd(TRANSACTION_REQUESTOR(RF_FIELD_EVT));
+ }
sRfFieldOff = true;
e->CallVoidMethod (nat->manager, android::gCachedNfcManagerNotifyRfFieldDeactivated);
}
@@ -1828,12 +1838,21 @@ static jboolean nfcManager_routeAid (JNIEnv* e, jobject, jbyteArray aid, jint ro
ScopedByteArrayRO bytes(e, aid);
uint8_t* buf = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(&bytes[0]));
size_t bufLen = bytes.size();
+
#if (NXP_EXTNS == TRUE)
if((nfcFL.nfccFL._NFC_NXP_STAT_DUAL_UICC_WO_EXT_SWITCH) &&
(route == 2 || route == 4)) { //UICC or UICC2 HANDLE
ALOGV("sCurrentSelectedUICCSlot: %d", sCurrentSelectedUICCSlot);
route = (sCurrentSelectedUICCSlot != 0x02) ? 0x02 : 0x04;
}
+ /*In case of 66T/67T field on is observed as last field event once reader
+ is removed from proximity, which will hold the transaction lock unnecessarily
+ In such cases end the lock as it is not required*/
+ if(((nfcFL.chipType == pn548C2) || (nfcFL.chipType == pn551)) &&
+ pTransactionController->getCurTransactionRequestor() == TRANSACTION_REQUESTOR(RF_FIELD_EVT))
+ {
+ pTransactionController->transactionEnd(TRANSACTION_REQUESTOR(RF_FIELD_EVT));
+ }
if(nfcManager_isTransanctionOnGoing(true))
{
return false;
@@ -2057,6 +2076,14 @@ static jint nfcManager_getRemainingAidTableSize (JNIEnv* , jobject )
static bool nfcManager_clearAidTable (JNIEnv*, jobject)
{
#if(NXP_EXTNS == TRUE)
+ /*In case of 66T/67T field on is observed as last field event once reader
+ is removed from proximity, which will hold the transaction lock unnecessarily
+ In such cases end the lock as it is not required*/
+ if(((nfcFL.chipType == pn548C2) || (nfcFL.chipType == pn551)) &&
+ pTransactionController->getCurTransactionRequestor() == TRANSACTION_REQUESTOR(RF_FIELD_EVT))
+ {
+ pTransactionController->transactionEnd(TRANSACTION_REQUESTOR(RF_FIELD_EVT));
+ }
if(nfcManager_isTransanctionOnGoing(true))
{
return false;
@@ -5865,7 +5892,7 @@ static void nfcManager_doSetScreenState (JNIEnv* e, jobject o, jint screen_state
return;
}
#endif
-
+ pendingScreenState = false;
int prevScreenState = getScreenState();
if(prevScreenState == state) {
ALOGV("Screen state is not changed. ");
@@ -6075,7 +6102,6 @@ static void nfcManager_doSetScreenOrPowerState (JNIEnv* e, jobject o, jint state
bool nfcManager_isRequestPending(void)
{
bool isPending = false;
-
if((transaction_data.current_transcation_state != NFA_TRANS_ACTIVATED_EVT) &&
((pendingScreenState == true) || (get_last_request() != 0x00)))
{
diff --git a/nci/jni/TransactionController.cpp b/nci/jni/TransactionController.cpp
index e2e745f2..990ab592 100755
--- a/nci/jni/TransactionController.cpp
+++ b/nci/jni/TransactionController.cpp
@@ -247,7 +247,7 @@ void transactionController::transactionEnd(const char* transactionRequestor)
killAbortTimer();
}
pTransactionDetail->trans_in_progress = false;
-
+ requestor = NULL;
ALOGD ("%s: Transaction ended : %s ", __FUNCTION__, transactionRequestor);
/*
@@ -283,6 +283,7 @@ bool transactionController::transactionTerminate(const char* transactionRequest
(requestor == transactionRequestor || !strcmp(transactionRequestor,"exec_pending_req")))
{
pTransactionDetail->trans_in_progress = false;
+ requestor = NULL;
killAbortTimer();
if(android::nfcManager_isRequestPending())
@@ -293,7 +294,6 @@ bool transactionController::transactionTerminate(const char* transactionRequest
sem_getvalue(&barrier, &val);
if(!val)
sem_post(&barrier);
-
ALOGD ("%s: Transaction terminated : %s ", __FUNCTION__, transactionRequestor);
return true;
}
@@ -396,3 +396,17 @@ void transactionController::setAbortTimer(unsigned int msec)
if(transactionInProgress())
abortTimer->set(msec, transactionAbortTimerCb);
}
+
+/*******************************************************************************
+ **
+ ** Function: getCurTransactionRequestor
+ **
+ ** Description: This function returns current active requestor
+ **
+ ** Returns: active requestor
+ **
+ *******************************************************************************/
+const char * transactionController::getCurTransactionRequestor()
+{
+ return requestor;
+} \ No newline at end of file
diff --git a/nci/jni/TransactionController.h b/nci/jni/TransactionController.h
index 8402db28..a0df7a1e 100755
--- a/nci/jni/TransactionController.h
+++ b/nci/jni/TransactionController.h
@@ -1,98 +1,99 @@
-/******************************************************************************
- *
- * Copyright (C) 2015 NXP Semiconductors
- *
- * 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.
- *
- ******************************************************************************/
-#pragma once
-#include <semaphore.h>
-#include <NfcJniUtil.h>
-extern "C"
-{
- #include "nfa_api.h"
-}
-#define TRANSACTION_REQUESTOR(name) #name
-#define TRANSACTION_ATTEMPT_FOR_SECONDS(seconds) (seconds)
-#define pTransactionController (transactionController::getInstance())
-
-
-
-/* Transaction Events in order */
-typedef enum transcation_events
-{
- NFA_TRANS_DEFAULT = 0x00,
- NFA_TRANS_ACTIVATED_EVT,
- NFA_TRANS_EE_ACTION_EVT,
- NFA_TRANS_DM_RF_FIELD_EVT,
- NFA_TRANS_DM_RF_FIELD_EVT_ON,
- NFA_TRANS_DM_RF_TRANS_START,
- NFA_TRANS_DM_RF_FIELD_EVT_OFF,
- NFA_TRANS_DM_RF_TRANS_PROGRESS,
- NFA_TRANS_DM_RF_TRANS_END,
- NFA_TRANS_MIFARE_ACT_EVT,
- NFA_TRANS_CE_ACTIVATED = 0x18,
- NFA_TRANS_CE_DEACTIVATED = 0x19,
-}eTranscation_events_t;
-/*Structure to store discovery parameters*/
-typedef struct discovery_Parameters
-{
- int technologies_mask;
- bool enable_lptd;
- bool reader_mode;
- bool enable_p2p;
- bool restart;
-}discovery_Parameters_t;
-/*Structure to store transcation result*/
-typedef struct Transcation_Check
-{
- bool trans_in_progress;
- char last_request;
- struct nfc_jni_native_data *transaction_nat;
- eScreenState_t last_screen_state_request;
- eTranscation_events_t current_transcation_state;
- discovery_Parameters_t discovery_params;
-#if(NXP_EXTNS == TRUE)
-#if(NXP_NFCC_HCE_F == TRUE)
- int t3thandle;
- bool isInstallRequest;
-#endif
-#endif
-} Transcation_Check_t;
-
-class transactionController
-{
- private:
- static transactionController* pInstance; //Reference to controller
- sem_t barrier; //barrier: Guard for controlling access to NFCC when profile switch happening
- IntervalTimer* abortTimer; //abortTimer: Used for aborting a stuck transaction
- IntervalTimer* pendingTransHandleTimer; //pendingTransHandleTimer: Used to schedule pending transaction handler thread
- Transcation_Check_t* pTransactionDetail; //transactionDetail: holds last transaction detail
- const char* requestor; //requestor: Identifier of transaction trigger
-
- transactionController(void); //Constructor
- bool transactionLiveLockable(const char* transactionRequestor);
- public:
- void lastRequestResume(void);
- bool transactionAttempt(const char* transactionRequestor, unsigned int timeoutInMsec);
- bool transactionAttempt(const char* transactionRequestor);
- bool transactionTerminate(const char* transactionRequestor);
- void transactionEnd(const char* transactionRequestor);
- bool transactionInProgress(void);
- void killAbortTimer(void);
- void setAbortTimer(unsigned int msec);
- static void transactionAbortTimerCb(union sigval);
- static void transactionHandlePendingCb(union sigval);
- static transactionController* controller(void);
- static transactionController* getInstance(void);
-};
+/******************************************************************************
+ *
+ * Copyright (C) 2015 NXP Semiconductors
+ *
+ * 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.
+ *
+ ******************************************************************************/
+#pragma once
+#include <semaphore.h>
+#include <NfcJniUtil.h>
+extern "C"
+{
+ #include "nfa_api.h"
+}
+#define TRANSACTION_REQUESTOR(name) #name
+#define TRANSACTION_ATTEMPT_FOR_SECONDS(seconds) (seconds)
+#define pTransactionController (transactionController::getInstance())
+
+
+
+/* Transaction Events in order */
+typedef enum transcation_events
+{
+ NFA_TRANS_DEFAULT = 0x00,
+ NFA_TRANS_ACTIVATED_EVT,
+ NFA_TRANS_EE_ACTION_EVT,
+ NFA_TRANS_DM_RF_FIELD_EVT,
+ NFA_TRANS_DM_RF_FIELD_EVT_ON,
+ NFA_TRANS_DM_RF_TRANS_START,
+ NFA_TRANS_DM_RF_FIELD_EVT_OFF,
+ NFA_TRANS_DM_RF_TRANS_PROGRESS,
+ NFA_TRANS_DM_RF_TRANS_END,
+ NFA_TRANS_MIFARE_ACT_EVT,
+ NFA_TRANS_CE_ACTIVATED = 0x18,
+ NFA_TRANS_CE_DEACTIVATED = 0x19,
+}eTranscation_events_t;
+/*Structure to store discovery parameters*/
+typedef struct discovery_Parameters
+{
+ int technologies_mask;
+ bool enable_lptd;
+ bool reader_mode;
+ bool enable_p2p;
+ bool restart;
+}discovery_Parameters_t;
+/*Structure to store transcation result*/
+typedef struct Transcation_Check
+{
+ bool trans_in_progress;
+ char last_request;
+ struct nfc_jni_native_data *transaction_nat;
+ eScreenState_t last_screen_state_request;
+ eTranscation_events_t current_transcation_state;
+ discovery_Parameters_t discovery_params;
+#if(NXP_EXTNS == TRUE)
+#if(NXP_NFCC_HCE_F == TRUE)
+ int t3thandle;
+ bool isInstallRequest;
+#endif
+#endif
+} Transcation_Check_t;
+
+class transactionController
+{
+ private:
+ static transactionController* pInstance; //Reference to controller
+ sem_t barrier; //barrier: Guard for controlling access to NFCC when profile switch happening
+ IntervalTimer* abortTimer; //abortTimer: Used for aborting a stuck transaction
+ IntervalTimer* pendingTransHandleTimer; //pendingTransHandleTimer: Used to schedule pending transaction handler thread
+ Transcation_Check_t* pTransactionDetail; //transactionDetail: holds last transaction detail
+ const char* requestor; //requestor: Identifier of transaction trigger
+
+ transactionController(void); //Constructor
+ bool transactionLiveLockable(const char* transactionRequestor);
+ public:
+ void lastRequestResume(void);
+ bool transactionAttempt(const char* transactionRequestor, unsigned int timeoutInMsec);
+ bool transactionAttempt(const char* transactionRequestor);
+ bool transactionTerminate(const char* transactionRequestor);
+ void transactionEnd(const char* transactionRequestor);
+ bool transactionInProgress(void);
+ void killAbortTimer(void);
+ void setAbortTimer(unsigned int msec);
+ static void transactionAbortTimerCb(union sigval);
+ static void transactionHandlePendingCb(union sigval);
+ static transactionController* controller(void);
+ static transactionController* getInstance(void);
+ const char * getCurTransactionRequestor();
+};