The performPoll method in the NetworkStatsService can be called
for many reasons, such as RAT changed events, LinkProperties
changed events, open session method calls, forceUpdate method
calls, etc.
However, the current logging is not sufficient to trace down
the caller of performPoll. This makes it difficult to debug
frequent poll issues or performance problems.
Adding debug log to logcat is not an option, given that
performPoll might run several times per second by system server
callers.
This change adds a reason code to the performPoll method and
a helper class to log performPoll events. This will allow us
to track down the caller of performPoll and better understand
why it is being called frequently or causing performance
problems.
This change also introduces a PollEvent object, which can be
used to put related information in subsequent changes when
logging.
Sample output:
Poll counts per reason:
DUMPSYS: 0
FORCE_UPDATE: 6
GLOBAL_ALERT: 0
NETWORK_STATUS_CHANGED: 3
OPEN_SESSION: 0
PERIODIC: 1
RAT_CHANGED: 1
REG_CALLBACK: 3
REMOVE_UIDS: 0
UPSTREAM_CHANGED: 1
Recent poll events:
2023-10-04T02:47:12.937370 - Poll(flags=3, PollEvent{reason=REG_CALLBACK})
2023-10-04T02:47:13.178559 - Poll(flags=3, PollEvent{reason=FORCE_UPDATE})
Test: manual
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsEventLoggerTest
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Bug: 301141955
Change-Id: Ic6d0543ccdef12493385f45200199854b841a26b
The TTL check and removal of expired services is currently only
performed when a mDNS query is sent. This can result in expired
services remaining in the cache if no queries are sent. To
address this, the remaining TTL will be checked when retrieving
services from the MdnsServiceCache. Add a new flag to enable
the expired services removal feature. This feature will be
implemented in subsequent changes.
Bug: 265787401
Bug: 304649384
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I30f0eea568ee45d363cc02821de0921d6040f981
This is catched by errorprone where global variables accessing
is not protected by the declared lock, which could lead to a
potiential race problem where these variables are changed but
cannot be seen for the invocation.
This is also safe since:
1. The method called inside mDefaultNetworks is already holding
the same lock.
2. Multiple global variables are protected by this synchronized
block.
Test: TH
Fix: 181642673
Change-Id: I58e7f124de1f0291e9323ab0b9cf8f52cec32818
This is a no-op change and refactors the design for subsequent
TTL expiration check changes.
- Add a ServiceExpiredCallback to notify expired services.
- To simplify the design, pass the CacheKey to MdnsServiceCache
methods instead.
Bug: 265787401
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I930a4f7baf9b8d3d0037dc6aefd717dbdd486520
Ethernet interface naming is not consistent on Linux. While some USB
ethernet dongles show up as eth0, others might show up as usb0.
This CL changes config_ethernet_iface_regex to "*" which stands for "use
Android version specific default". The default will include both usb\d+
and eth%d named interfaces on Android U+. Android T will continue to
only include eth%d interfaces (note that the "+" is a new addition which
is highly unlikely to have any actual effect, but is more technically
correct).
Bug: 304335605
Test: TH
Change-Id: I823be8ee390cb2b6dd41b537c72ed76f5aa9e0ea
service-connectivity-mdns-standalone-build-test builds the mDNS
discovery and advertisement implementation against API level 21.
This stops the advertisement code from calling new NsdServiceInfo
public or private APIs which are required by Thread.
This commit removes the mDNS advertisement code from the standalone
build to loose the check given this will never be used by GMS Core.
Bug: 265095929
Test: verified that it can build with aosp/2608627
Change-Id: I32cfce7b994d51a4b4ec468e9f79ffc2be6635ff
Per RFC6762#8.1, a host can simultaneously probe for uniqueness
of its "A" record and all its SRV records [RFC6763] in the same
query message. Add a flag to include the A/AAAA records in the
probing packet if necessary.
Test: atest FrameworksNetTestCases NsdManagerTest
Change-Id: I365a938a6c481df755a0598b175069b94905fa3b
The value of `path` here should be a no-op in Soong's cpp compile
action. Dropping this property helps bazel migration since Bazel's
filegroup rule does not have a path property.
Test: m libnetworkstatsfactorytestjni libservice-connectivity
Bug: 297405814
Change-Id: I7879224bf6deb12417d92e9a3fa52f58fccac999
Network tracing was only available on userdebug and eng builds. This
change makes it available on all build types behind a flag.
Bug: 298197881
Test: flash & trace, toggle flag on/off
Change-Id: I75d854aee74adf7e23f7a970b20233790f9b0354
The transaction id is a number that is used to identify a
specific query packet. But it's not necessary for probing
or announcing services, so the transaction id is not
currently used on advertising when creating a MdnsPacket or
decoding the response to a MdnsPacket. This means that it is not
possible to track which query packets have received
responses. Therefore, store the transaction id so that
it can be used for subsequent query packet changes.
Bug: 302269599
Test: atest FrameworksNetTests
Change-Id: I6734752b32b91678afb7df06e1fa51237cf70894
If the flag value is unset or 0, isFeatureEnabled return false and
isFeatureNotChickenedOut return true.
If the flag value is -1 (force disable), both return false.
If the flag value is other values, both query the package version and
return `flagValue <= packageVersion`
Now the only difference is a default behavior when the flag is not set
or 0.
So isFeatureEnabled and isFeatureNotChickenedOut can use the same flag.
This CL also fixes the issue in rollback.
Before this CL, isFeatureNotChickenedOut did not check the module
version and could have a issue if there is a rollback.
Test: NetworkStaticLibsTests
Bug: 279108992
Change-Id: I12d6ebadff3aee7b7c614aca4eb0a34ef0db9857
Limit the amount of parked code built into Connectivity module
Test: built successfully.
Bug: 300522527
Change-Id: I87d7516011c469aa89fc7e67cf03c4ee8aa1bb9b
This adds support for additional protocols and also provides more clear
semantics of protocol specific fields, such as only including tcpFlags
when the protocol is IPPROTO_TCP.
Test: atest libnetworkstats_test & flash and trace
Change-Id: Ic69fc75e85ebf8734027c942a253af4972ad14d8
This change refactors BundleKey to be a separate struct. This allows
us to do the conversion (e.g. of sport/dport, or icmp fields in the
future) in the constructor and change types (use optionals) where it
is convenient to simplify the code.
This change also fixes a bunch of desigated initializer order warnings
in the test (fields should be declared in same order as defined).
Test: atest libnetworkstats_test
Change-Id: I6373d2512280e93c54395fde38dcff43705b449e