Commit graph android_packages_modules_Co.../tests/unit/java/com/android/server
Message SHA1
Revert "Revert "Record DiscoveryManager history logs for better ..."
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

Paul Hu   commited 2023-04-18 14:50:31 +08:00
24913d0e80
Merge changes from topic "revert-2535219-TAMNEZLAHT"
* 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"

Paul Hu   authored and   Gerrit Code Review   commited 2023-04-18 02:53:21 +00:00
f0f83b6fc3
Revert "Record DiscoveryManager history logs for better debugging"
Revert submission 2535219

Reason for revert: Build break

Reverted changes: /q/submissionid:2535219

Change-Id: I9c8486e95e0b28ec4206d1e69858ab401888895a

Paul Hu   commited 2023-04-18 02:45:34 +00:00
2f0e914375
Revert "Record Advertiser history logs for better debugging"
Revert submission 2535219

Reason for revert: Build break

Reverted changes: /q/submissionid:2535219

Change-Id: I19496223d6f54120c17d690fd760e6743e3877b8

Paul Hu   commited 2023-04-18 02:45:34 +00:00
5f558683b3
Merge changes I41743f47,I22577615,I46f806a8,Icaa1df2e
* 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

Paul Hu   authored and   Gerrit Code Review   commited 2023-04-18 01:14:39 +00:00
0b39135e3e
Merge "Only send resolve callbacks for subscribed service"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-04-17 13:16:15 +00:00
8a54f204d6
Merge "Cleanup : don't mix seconds and milliseconds in retry delays"
Jean Chalard   authored and   Gerrit Code Review   commited 2023-04-17 10:01:56 +00:00
52c215bbc7
Only send resolve callbacks for subscribed service
Resolve callbacks should only be sent for the service name that was
requested.

Bug: 267570781
Test: atest MdnsServiceTypeClientTests
Change-Id: I3d8eb5c06bcf54312e20a39b8575555d40528bca

Remi NGUYEN VAN   commited 2023-04-17 18:55:36 +09:00
8a41185ce6
Record Advertiser history logs for better debugging
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

Paul Hu   commited 2023-04-17 15:38:28 +08:00
1571df639a
Record DiscoveryManager history logs for better debugging
Log:
  2023-04-17T15:05:28.428369 - Unregistering listener for serviceType:_nmt274981618._tcp.local
  2023-04-17T15:05:28.228777 - [_nmt274981618._tcp.local-102] onServiceFound: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試
  2023-04-17T15:05:28.227786 - [_nmt274981618._tcp.local-102] onServiceNameDiscovered: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試
  2023-04-17T15:05:27.409364 - createServiceTypeClient for serviceType:_nmt274981618._tcp.local network:103
  2023-04-17T15:05:27.409104 - createServiceTypeClient for serviceType:_nmt274981618._tcp.local network:102
  2023-04-17T15:05:27.407701 - createServiceTypeClient for serviceType:_nmt274981618._tcp.local network:101
  2023-04-17T15:05:27.398075 - Registering listener for serviceType: _nmt274981618._tcp.local

Test: atest FrameworksNetTests android.net.cts.NsdManagerTest
Bug: 275004614
Change-Id: Icaa1df2e7019e5cce1b4eca7edcb4a761b7b20cf

Paul Hu   commited 2023-04-17 15:30:42 +08:00
d74697aa96
Merge "Test that VPN lockdown restarts the VPN agent."
Jean Chalard   authored and   Gerrit Code Review   commited 2023-04-17 05:38:54 +00:00
2c930437e9
Merge "Add test for updating IKE about IP address changes"
Jean Chalard   authored and   Gerrit Code Review   commited 2023-04-17 05:36:35 +00:00
ca35653803
Merge "Adjust tests for delay in restarting/migrating IKE"
Jean Chalard   authored and   Gerrit Code Review   commited 2023-04-17 05:35:21 +00:00
6213d571a8
Merge "Separate events usage for starting socket keepalives"
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-04-17 02:32:00 +00:00
2cf6b2c4fd
Merge "Fix inexact argument type warning"
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-04-17 01:48:31 +00:00
baefd61455
Handle downstream tethering interface addresses in MdnsSocketProvider
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

Yuyang Huang   commited 2023-04-15 21:55:51 +09:00
700778be70
Separate events usage for starting socket keepalives
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

chiachangwang   commited 2023-04-14 07:43:56 +00:00
f1b1fb4b7f
Test that VPN lockdown restarts the VPN agent.
Bug: 246162564
Test: atest FrameworksNetTests:VpnTest
Change-Id: I35f08bf263cec19bbfb1d656d1d89dbb0acf8944

Chalard Jean   commited 2023-04-14 16:38:19 +09:00
23197121a1
Cleanup : don't mix seconds and milliseconds in retry delays
Test: VpnTest
Change-Id: I5ceda621ba96549a514ec98176b799e246e6d9a5

Chalard Jean   commited 2023-04-14 13:05:34 +09:00
7afb623223
Add test for updating IKE about IP address changes
Bug: 269715746
Test: VpnTest
Change-Id: I2c3a7f0f0af193b5497beaff38d54a80020a7aa0

Chalard Jean   commited 2023-04-14 12:22:46 +09:00
2b9bcb7830
Adjust tests for delay in restarting/migrating IKE
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

Chalard Jean   commited 2023-04-14 12:22:46 +09:00
9d85c7aa4c
Fix inexact argument type warning
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

chiachangwang   commited 2023-04-14 01:58:18 +00:00
25c74bd250
Merge "Include/exclude mDNS interfaces based on transport"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-04-12 05:28:02 +00:00
5864b59462
Include/exclude mDNS interfaces based on transport
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

Remi NGUYEN VAN   authored and   Yuyang Huang   commited 2023-04-12 12:43:00 +09:00
145b16cb5a
bpf network stats - remove dead code
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

Maciej Żenczykowski   commited 2023-04-11 19:24:28 +00:00
b548e191de
Avoid creating a Network with INetd.LOCAL_NET_ID
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

Yuyang Huang   commited 2023-04-05 13:06:13 +09:00
3bee9d4099
Merge "Request cell in #testExplicitlySelected"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-03-28 07:57:33 +00:00
dafaf2a08b
Merge "Adjust polling interval for auto on/off keepalives"
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-03-27 06:05:08 +00:00
0342985117
Adjust polling interval for auto on/off keepalives
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

chiachangwang   commited 2023-03-25 09:15:08 +00:00
d953d0182a
Merge "Verify the update of shouldLongLivedTcpExcluded in VpnTransportInfo"
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-03-25 04:12:22 +00:00
ce1bc54e66
Merge "Clean up the LinkProperties when stop monitoring sockets"
Paul Hu   authored and   Gerrit Code Review   commited 2023-03-21 01:30:05 +00:00
46eb5f4b5e
Clean up the LinkProperties when stop monitoring sockets
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

Paul Hu   commited 2023-03-20 15:06:05 +08:00
13921b2cdc
Merge changes from topics "nonAutoIPSelection", "preferredIpProtocol"
* changes:
  Test IP version and encap type set in non-auto IP selection mode
  Test reading preferred IP protocol from carrierconfig

Chiachang Wang   authored and   Gerrit Code Review   commited 2023-03-20 02:39:42 +00:00
f6682143ac
Merge "Add a CompatChange flag to enable platform backend"
Paul Hu   authored and   Gerrit Code Review   commited 2023-03-17 13:14:19 +00:00
62503cfef1
Connectivity Tests: join handler thread after calling quitSafely
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

Patrick Rohr   commited 2023-03-17 01:01:09 -07:00
98021b650b
Merge "Factor out adding records to a generic"
Paul Hu   authored and   Gerrit Code Review   commited 2023-03-17 02:30:39 +00:00
a08f8867f8
Verify the update of shouldLongLivedTcpExcluded in VpnTransportInfo
Bug: 273422889
Test: atest FrameworksNetTests
Change-Id: I5e25d1b8b1f86dc4474cef1616cb16668119240a

chiachangwang   commited 2023-03-17 02:04:13 +00:00
052dbb85d3
Add a CompatChange flag to enable platform backend
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

Paul Hu   commited 2023-03-17 09:10:46 +08:00
2e0a88c0fa
Request cell in #testExplicitlySelected
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

Chalard Jean   commited 2023-03-16 22:12:52 +09:00
7cf34ec1cd
Test IP version and encap type set in non-auto IP selection mode
Test: atest FrameworksNetTests
Change-Id: I8f4a54f7b35135806c940b5cee2c600f4454f2fb

chiachangwang   commited 2023-03-16 03:00:45 +00:00
e1aacc797c
IpConfigStoreTest: increase timeout for waitForIdle
waitForIdle in readIpConfigurationFromFilePath times out.

Test: TH
Change-Id: I5bc8c5b4678b984ec6406d85725297a63faeaabf

Patrick Rohr   commited 2023-03-15 19:48:25 +00:00
c641e019ef
Test reading preferred IP protocol from carrierconfig
Bug: 259000745
Test: atest FrameworksNetTests
Change-Id: Ie9f546ae60fcc2e21479e5d7cbc86c96cfbedc84

chiachangwang   commited 2023-03-15 05:20:22 +00:00
55dc7b6e9f
Merge changes from topics "kpFromCarrier", "noNetCapNoMigration"
* changes:
  Verify no migration started without valid network capabilties
  Test reading keepalive timer from carrierconfig

Chiachang Wang   authored and   Gerrit Code Review   commited 2023-03-09 12:17:21 +00:00
c211511b64
Verify no migration started without valid network capabilties
Bug: 269714970
Test: atest FrameworksNetTests
Change-Id: I0f1a8cbdcb0a8a102036388b39162dca775c3f5d

chiachangwang   commited 2023-03-09 09:02:40 +00:00
334b8dba3a
Test reading keepalive timer from carrierconfig
Bug: 259000745
Test: atest FrameworksNetTests
Change-Id: I2e750a7b090dd09553fae921163e19fc99a2d582

chiachangwang   commited 2023-03-09 09:01:17 +00:00
3a91e2d4f6
Merge "Remove unused augmentWithStackedInterfaces"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-03-09 06:55:24 +00:00
e9df7ca57f
Merge "Update system APIs based on feedback."
Jeff Sharkey   authored and   Gerrit Code Review   commited 2023-03-09 02:47:49 +00:00
31b6c65f51
Merge changes from topic "PerNetworkServiceTypeClient"
* changes:
  Create MdnsServiceTypeClient per network
  Wait for a socket to be created before sending packets

Paul Hu   authored and   Gerrit Code Review   commited 2023-03-08 11:14:57 +00:00
71c006bd14
Merge "Migrate reigster service callback backend"
Paul Hu   authored and   Gerrit Code Review   commited 2023-03-08 10:27:57 +00:00
ee0e6cd701
Remove unused augmentWithStackedInterfaces
after the commit aosp/1948496, both mMobileIfaces and mWifiIfaces
already contain the stacked interfaces. Hence, the method is not
really useful.

Test: TH
Fix: 215633405
Change-Id: Id132a166e9cf94cab711f417a4f7ffc84eab6185

Junyu Lai   commited 2023-03-08 13:49:00 +08:00
615610c3d1