* changes:
Revert^2 "Put client logs into SharedLog and dump more logs"
Revert^2 "Record Advertiser history logs for better debugging"
Revert "Revert "Record SocketProvider history logs for better de..."
Revert "Revert "Record DiscoveryManager history logs for better ..."
The setup for the mocking object will be reset when each test
finishs the test. Reset the mocking value is actually no-op
but cause possible threading issue in Mokito.
Bug: 278979735
Test: atest com.android.server.connectivity.VpnTest \
--rerun-until-failure 100
Change-Id: Ib8c3813e5dbcc9b7432a5548766d63e400b4ed0e
Revert submission 2542434-revert-2535219-TAMNEZLAHT
Reason for revert: Prepare a fix for the original topic
Reverted changes: /q/submissionid:2542434-revert-2535219-TAMNEZLAHT
Change-Id: I718418e4499784255b177622e3c08a82d0b24640
* changes:
Revert "Record DiscoveryManager history logs for better debugging"
Revert "Record SocketProvider history logs for better debugging"
Revert "Record Advertiser history logs for better debugging"
Revert "Put client logs into SharedLog and dump more logs"
* changes:
Put client logs into SharedLog and dump more logs
Record Advertiser history logs for better debugging
Record SocketProvider history logs for better debugging
Record DiscoveryManager history logs for better debugging
Resolve callbacks should only be sent for the service name that was
requested.
Bug: 267570781
Test: atest MdnsServiceTypeClientTests
Change-Id: I3d8eb5c06bcf54312e20a39b8575555d40528bca
This also updates the tests and prepares them to assert the other fields
of DailyKeepaliveInfoReported. Currently, only DurationPerNumOfKeepalive
is asserted.
Bug: 273451360
Test: atest FrameworksNetTests
Change-Id: I727849fa8a08d66fe276909b353a75861c23d775
Create a new class to store duration metrics of AutomaticOnOffKeepalives
for the DurationPerNumOfKeepalive proto.
This tracks the duration of time that the AutomaticOnOffKeepaliveTracker
contains a given number of concurrent keepalives and the duration of
time that it contains a given number of active concurrent keepalives.
Bug: 273451360
Test: atest FrameworksNetTests
Change-Id: If31ccbc7b02e6ad3ff1646e92e55ca7c8662e47c
Log:
2023-04-12T20:00:18.100961 - Removing service with ID 2
2023-04-12T20:00:17.173904 - [wlan0] Probing finished for service 2
2023-04-12T20:00:17.147089 - [testtap1] Probing finished for service 2
2023-04-12T20:00:17.074575 - [testtap0] Probing finished for service 2
2023-04-12T20:00:16.249636 - Adding service name: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試, type: _nmt950580894._tcp, hostAddresses: , port: 12345, network: null, txtRecord: with ID 2
Test: atest FrameworksNetTests android.net.cts.NsdManagerTest
Bug: 275004614
Change-Id: I22577615b0b2c212c0a4349a06ef3c75239a5651
MdnsSocketProvider currently does not fill addresses of downstream
tethering interfaces in its callbacks. The interface addresses should be
properly updated by listening to the Netlink messages.
Test: atest FrameworksNetTests CtsNetTestCases
Bug: 267980538
Change-Id: I753e547a1b092703fe59c6c9e922ee8aca245f67
This is a clean up commit to correct the javadoc of
NetworkAgent.CMD_START_SOCKET_KEEPALIVE. This event was used
between ConnectivityService/NetworkAgent, and also
ConnectivityService/KeepaliveTracker with different semantics.
This may confuse the developers to update the doc incorrectly,
so also separate the usage to different events.
Also move the event definitions together so that a new event
definition will not mis-use the existing values.
Test: atest FrameworksNetTests
Change-Id: I73ebd8abcc610531da3057da2d643a41befb2099
This patch only adjusts the existing tests for the change
in the companion patch. Actual tests will come as a followup
because this patch is already big enough.
Test: VpnTest
Bug: 269715746
Change-Id: I65542a8f4151b4857f1b3758b2cae887bfbfe261
Assign the corresponding VpnProfileState for the null argument.
The varargs parameter has type "VpnProfileState...". It needs
to decide whether the implementation want the argument to be
treated as a single-element of type VpnProfileState or no
arguement. Otherwise, it will confuse the compiler and cause
warning.
Test: atest VpnTest
Change-Id: Ic1dee696bb50cd78849de4812fb46fd764b23c6e
Regardless of IFF_MULTICAST (and IFF_BROADCAST), always include wifi
transport interfaces, and always exclude cellular transport interfaces.
Some interfaces do not have the multicast or broadcast flag set
properly. Use the transport to determine whether to use them, rather
than the interface flags.
Bug: 268138840
Test: atest MdnsSocketProviderTest
Change-Id: Idbddfa9d2cc05ce1850786aa634da4c38afd3fc0
only the test code ever passes in anything that isn't
a limit {UID_ALL, INTERFACES_ALL, TAG_ALL} (ie. no limit)
Test: TreeHugger, atest libnetworkstats_test FrameworksNetTests
Bug: 276296921
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ida489f25c4da4b12541c6001b41d9e4b30804eff
Follow up from aosp/1933093. The test failed because certain
devices use a flattened apex that lacks the NETWORK_STACK
permission for sharing with the GTS apk.
Additionally, the NetworkStatsAccess does not recognize the
GTS apk, which holds the MAINLINE_NETWORK_STACK permission.
Test: TH
Bug: 275532605
Change-Id: Icce80a3d3dbea4a84fbd369d9b5fbe0029ab463e
INetd.LOCAL_NET_ID cannot be referred to by system SDK. To make the
MdnsSocketProvider built with system SDK, the reference to
INetd.LOCAL_NET_ID must be removed.
This network is created in MdnsSocketProvider.java and propagated
through MdnsSocketProvider.java -> MdnsMultinetworkSocketClient.java ->
MdnsDiscoveryManager.java -> MdnsServiceTypeClient.java ->
NsdService.java. In NsdService.java, it was used in
handleMdnsDiscoveryManagerEvent() -> buildNsdServiceInfoFromMdnsEvent()
-> setServiceNetworkForCallback(). The setServiceNetworkForCallback() is
updated to handle the NETID_UNSET the same as LOCAL_NET_ID.
Test: atest CtsNetTestCases FrameworksNetTests
Bug: 272392042
Change-Id: I07c573948e9dc6249325f0733807bb7a7ffc281c
The system polls TCP connections every 2 minutes for the auto
on/off keepalives. For some carriers, the NAT-T keepalive delay
is lower than this, which means it's possible a TCP connection
is opened seconds after the poll. This may cause connections
being disconnected because keepalive timed-out.
The minimal acceptable value should be the same as the keepalive
delay. But the system may take time to restart keepalive. Adjust
the delay of the polling alarm to be lower than the keepalive
delay to preserve some time for the system to restart the
keepalive.
Bug: 273411114
Test: atest FrameworksNetTests
Change-Id: I28f71ceb7b72d83e6e0f8f7d22d3d1e9dbdaa467
The active network LinkProperties are not cleaned up after stop
socket monitoring. Then the apps will have duplicate sockets
to discover on one interface if the interface has been toggled,
because requestSocket will return both the old socket (for the
old netId that is actually gone) and a new socket on the same
interface, for the new netId. Thus, clean up the LinkProperties
when stop monitoring sockets.
Bug: 274063187
Test: atest FrameworksNetTests android.net.cts.NsdManagerTest
Change-Id: I3d600169b069a1534bd740e711bc21db107b1201
Somewhat surprisingly, HandlerThread#quitSafely is *not* a synchronous
method, so the tearDown() method still needs to wait for the thread to
join.
Test: TH
Change-Id: I0433e2100adf9299a67af5c259a518cf44f4be57
Apps targeting sdk < U are considered to use a legacy native
daemon as NsdManager backend, but other apps use a
platform-integration mDNS implementation as backend. So add a
CompatChange flag to enable platform backend for non-legacy
apps.
Bug: 270306772
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I7ba58f8a5186fb49ad5f8aeacc8b8234bef1eabe
When the test is very slow (e.g. in coverage tests) it's
possible this test takes > 30 seconds and cell finishes
lingering before the end of the test. This will cause a
disconnection of cell before wifi and fail the test.
Address this by requesting cell.
Bug: 273383734
Test: atest --iterations 100 'FrameworksNetTests:android.net.connectivity.com.android.server.ConnectivityServiceTest#testExplicitlySelected'
Change-Id: I06a7ef82de966b522e58a969c25a4c0335dbc497