Reduce the performance impact of reading APF counters This removes the counter read before every program installation which can (and generally will) happen *very* frequently. Instead, increase the polling frequency to 5 minutes. Overall, this should lead to a drastic reduction of HAL calls. It shall also be noted that this additional call to startReadPacketFilter was never added to LegacyApfFilter, so this code path only becomes active once the ApfFilter experiment rolls out. Bug: 467472257 Test: TH Change-Id: Ifc613e8fbd346bba476f642fed2dcb75500bdb35
diff --git a/src/android/net/apf/ApfFilter.java b/src/android/net/apf/ApfFilter.java index c8e43d0..b5729d3 100644 --- a/src/android/net/apf/ApfFilter.java +++ b/src/android/net/apf/ApfFilter.java
@@ -2436,8 +2436,6 @@ return; } if (mIsRunning) { - // Update data snapshot every time we install a new program - mIpClientCallback.startReadPacketFilter("new program install"); if (!mIpClientCallback.installPacketFilter(program)) { sendNetworkQuirkMetrics(NetworkQuirkEvent.QE_APF_INSTALL_FAILURE); }
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java index 7e21116..223ed75 100644 --- a/src/android/net/ip/IpClient.java +++ b/src/android/net/ip/IpClient.java
@@ -599,7 +599,7 @@ static final String CONFIG_APF_COUNTER_POLLING_INTERVAL_SECS = "ipclient_apf_counter_polling_interval_secs"; @VisibleForTesting - static final int DEFAULT_APF_COUNTER_POLLING_INTERVAL_SECS = 1800; + static final int DEFAULT_APF_COUNTER_POLLING_INTERVAL_SECS = 300; // Used to wait for the provisioning to complete eventually and then decide the target // network type, which gives the accurate hint to set DTIM multiplier. Per current IPv6