Flag sending of the ECP ignore frame

Bug: 383047950
Test: manual
Flag: com.android.nfc.module.flags.reader_mode_ignore_frame
Change-Id: I05e38bc52d8dcb4328fa84759311a2fa0045881c
diff --git a/NfcNci/flags/wallet_integration_flags.aconfig b/NfcNci/flags/wallet_integration_flags.aconfig
index 4c2b441..90206a1 100644
--- a/NfcNci/flags/wallet_integration_flags.aconfig
+++ b/NfcNci/flags/wallet_integration_flags.aconfig
@@ -13,4 +13,7 @@
     namespace: "wallet_integration"
     description: "Enable exit frames to improve autotransact performance."
     bug: "380455428"
-}
\ No newline at end of file
+}
+
+# Don't add any new flags for Android 16+ targeting features. Use the flags
+# in com.android.nfc.module.flags (packages/modules/Nfc/flags) instead.
diff --git a/NfcNci/nci/jni/Android.bp b/NfcNci/nci/jni/Android.bp
index 88c7f34..2c6b1b6 100644
--- a/NfcNci/nci/jni/Android.bp
+++ b/NfcNci/nci/jni/Android.bp
@@ -68,6 +68,7 @@
         "android_nfc_flags_aconfig_c_lib",
         "server_configurable_flags",
         "libxml2",
+        "com.android.nfc.module.flags-aconfig-cpp",
     ],
 
     defaults: [
diff --git a/NfcNci/nci/jni/NativeNfcManager.cpp b/NfcNci/nci/jni/NativeNfcManager.cpp
index f6c769f..f0f15d6 100644
--- a/NfcNci/nci/jni/NativeNfcManager.cpp
+++ b/NfcNci/nci/jni/NativeNfcManager.cpp
@@ -39,6 +39,7 @@
 #include "SyncEvent.h"
 #include "android_nfc.h"
 #include "ce_api.h"
+#include "com_android_nfc_module_flags.h"
 #include "debug_lmrt.h"
 #include "nfa_api.h"
 #include "nfa_ee_api.h"
@@ -49,6 +50,8 @@
 
 using android::base::StringPrintf;
 
+using com::android::nfc::module::flags::reader_mode_ignore_frame;
+
 extern tNFA_DM_DISC_FREQ_CFG* p_nfa_dm_rf_disc_freq_cfg;  // defined in stack
 namespace android {
 extern bool gIsTagDeactivating;
@@ -1877,7 +1880,7 @@
                                         (const uint8_t*)annotationBytes.get(),
                                         annotationBytes.size());
         }
-      } else {
+      } else if (reader_mode_ignore_frame()) {
         uint8_t ignoreFrame[] = {0x6a, 0x01, 0xcf, 0x00, 0x00};
         setTechAPollingLoopAnnotation(e, 0, ignoreFrame, 5);
       }
diff --git a/flags/Android.bp b/flags/Android.bp
index a7995d6..66803ef 100644
--- a/flags/Android.bp
+++ b/flags/Android.bp
@@ -38,3 +38,17 @@
         "//packages/modules/Nfc:__subpackages__",
     ],
 }
+
+cc_aconfig_library {
+    name: "com.android.nfc.module.flags-aconfig-cpp",
+    aconfig_declarations: "com.android.nfc.module.flags-aconfig",
+    min_sdk_version: "35",
+    host_supported: true,
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.nfcservices",
+    ],
+    visibility: [
+        "//packages/modules/Nfc:__subpackages__",
+    ],
+}
diff --git a/flags/flags.aconfig b/flags/flags.aconfig
index bc451bf..bae59bc 100644
--- a/flags/flags.aconfig
+++ b/flags/flags.aconfig
@@ -15,4 +15,15 @@
     namespace: "wallet_integration"
     description: "Enables NFC-A polling loop annotations in reader mode"
     bug: "398910589"
-}
\ No newline at end of file
+}
+
+flag {
+    name: "reader_mode_ignore_frame"
+    namespace: "wallet_integration"
+    description: "Enable ignore frames in the default reader mode polling loop."
+    bug: "383047950"
+    metadata {
+        purpose: PURPOSE_BUGFIX
+    }
+}
+