Merge remote-tracking branch 'origin/Bitra.LA.3.2.1' into fp4t-qssi-0413
diff --git a/nci/SN100x/jni/NativeNfcManager.cpp b/nci/SN100x/jni/NativeNfcManager.cpp
index 17e0f40..3affec2 100644
--- a/nci/SN100x/jni/NativeNfcManager.cpp
+++ b/nci/SN100x/jni/NativeNfcManager.cpp
@@ -1453,6 +1453,9 @@
   uint8_t* buf;
   size_t bufLen;
 #if (NXP_EXTNS == TRUE)
+  if (sIsDisabling || !sIsNfaEnabled) {
+    return false;
+  }
   static int sT4tPowerState = 0;
   if (aid == NULL)
     RoutingManager::getInstance().checkAndUpdateAltRoute(route);
@@ -1506,6 +1509,11 @@
 **
 *******************************************************************************/
 static jboolean nfcManager_unrouteAid(JNIEnv* e, jobject, jbyteArray aid) {
+#if (NXP_EXTNS == TRUE)
+  if (sIsDisabling || !sIsNfaEnabled) {
+    return false;
+  }
+#endif
   uint8_t* buf;
   size_t bufLen;
 
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 0a340f4..c5e37ed 100644
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -2980,7 +2980,7 @@
                 // Build a new Tag object to return
                 try {
                     Tag newTag = new Tag(tag.getUid(), tag.getTechList(),
-                            tag.getTechExtras(), tag.getHandle(), this);
+                            tag.getTechExtras(), tag.getHandle(), mCookieUpToDate, this);
                     return newTag;
                 } catch (Exception e) {
                     Log.e(TAG, "Tag creation exception.", e);
@@ -3031,12 +3031,6 @@
         }
 
         @Override
-        public void setTagUpToDate(long cookie) throws RemoteException {
-            if (DBG) Log.d(TAG, "Register Tag " + Long.toString(cookie) + " as the latest");
-            mCookieUpToDate = cookie;
-        }
-
-        @Override
         public boolean isTagUpToDate(long cookie) throws RemoteException {
             if (mCookieUpToDate == cookie) {
                 if (DBG) Log.d(TAG, "Tag " + Long.toString(cookie) + " is up to date");
@@ -3857,7 +3851,7 @@
                     extras.putInt(Ndef.EXTRA_NDEF_TYPE, Ndef.TYPE_OTHER);
                     Tag tag = Tag.createMockTag(new byte[]{0x00},
                             new int[]{TagTechnology.NDEF},
-                            new Bundle[]{extras});
+                            new Bundle[]{extras}, mCookieUpToDate);
                     Log.d(TAG, "mock NDEF tag, starting corresponding activity");
                     Log.d(TAG, tag.toString());
                     int dispatchStatus = mNfcDispatcher.dispatchTag(tag);
@@ -4602,7 +4596,8 @@
         private void dispatchTagEndpoint(TagEndpoint tagEndpoint, ReaderModeParams readerParams) {
             try {
                 Tag tag = new Tag(tagEndpoint.getUid(), tagEndpoint.getTechList(),
-                        tagEndpoint.getTechExtras(), tagEndpoint.getHandle(), mNfcTagService);
+                        tagEndpoint.getTechExtras(), tagEndpoint.getHandle(),
+                        mCookieUpToDate, mNfcTagService);
                 registerTagObject(tagEndpoint);
                 if (readerParams != null) {
                     try {