Commit Graph

1485 Commits

Author SHA1 Message Date
Yuyang Huang
09cad2bc2d Merge "Uses identical hostName across all interface" 2023-03-02 23:40:29 +00:00
Ahmad Khalil
8d45846632 Merge "Revert "Implement the stop resolution with MdnsDiscoveryManager"" 2023-03-02 11:58:28 +00:00
Ahmad Khalil
4b8d45a4c1 Revert "Implement the stop resolution with MdnsDiscoveryManager"
This reverts commit 6d77c41f2a.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=aosp_cf_x86_64_phone-userdebug&lkgb=9678930&lkbb=9678975&fkbb=9678975, bug b/271400306

Change-Id: I8bfd2b8117ea401df7441116b983f5fe19f63d5d
BUG: 271400306
2023-03-02 11:43:25 +00:00
Paul Hu
1246c7243b Merge "Implement the stop resolution with MdnsDiscoveryManager" 2023-03-02 10:31:30 +00:00
Paul Hu
6772a31c5a Merge "Stop monitoring sockets until all sockets are unrequested" 2023-03-02 10:21:05 +00:00
Yuyang Huang
7311c42b94 Uses identical hostName across all interface
In case a host has two interfaces (e.g. wifi and ethernet) that are
bridged on the router side, hosts on the network would receive service
advertisements for both interfaces. If each interface uses a different
hostname, this creates a problem where service SRV records would point
to two different hostnames. Generating a hostname for all interfaces can
fix this problem. The hostname will be regenerated if all the clients
for NsdService are disconnected.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 268153179
Change-Id: Icdd2991233729b7f90e65984ca0381e32ab4ce93
2023-03-02 16:33:17 +09:00
Paul Hu
6d77c41f2a Implement the stop resolution with MdnsDiscoveryManager
The resolveService() uses new mdns backend if the
MdnsDiscoveryManager feature is enabled. So the new API
stopServiceResolution() should have new mdns backend
implementation as well.

Test: atest FrameworksNetTests
Change-Id: I591e78180f530daa701e0970860f7471f5f5fb9a
2023-03-02 14:57:25 +08:00
Remi NGUYEN VAN
9e54059c5d Merge changes I8157c373,I495db18d
* changes:
  Build MdnsResponse in ServiceTypeClient
  Support follow-up queries for missing records
2023-03-02 03:53:29 +00:00
Paul Hu
58f2060614 Stop monitoring sockets until all sockets are unrequested
Now MdnsSocketProvider is stopped when there is no client request
left in NsdService, but this does not trigger
SocketCallback.onInterfaceDestroyed callbacks. If the network of
the socket is then lost while MdnsSocketProvider is not
monitoring, no callback will be fired. Users of the socket
(MdnsDiscoveryManager and MdnsAdvertiser) may keep using it
without ever getting notified. So ignore the stop and wait until
all sockets are unrequested. Then the socket destroy should be
notified to all users.

Bug: 267978487
Test: atest FrameworksNetTests
Change-Id: I7a8bb0550262fe397b91f1236a8dbca1cf2c7518
2023-03-02 10:56:35 +08:00
Remi NGUYEN VAN
016aad904d Build MdnsResponse in ServiceTypeClient
Instead of building MdnsResponse lists in MdnsSocketClient and sending
each one to ServiceTypeClient, only parse packets in MdnsSocketClient,
and let each ServiceTypeClient build the MdnsResponse from them.

MdnsResponseDecoder already implements the same filtering that
MdnsDiscoveryManager#onResponseReceived did on the service types so this
is a no-op.

This will be useful to allow MdnsServiceTypeClient to update its
responses using records that are not necessarily part of a full
MdnsResponse; for example if a reply packet only contains address
records, or only SRV/TXT records without a PTR record.

Bug: 267570781
Test: atest
Change-Id: I8157c3732c425aae497d44c44c64b640859c13dc
2023-03-01 16:17:43 +09:00
Yuyang Huang
a908d816de Merge "Check network slicing declaration for network request" 2023-03-01 02:13:31 +00:00
Suprabh Shukla
1e31203fcc Add network handle to the nflog prefix for wakeups
This is useful in the system server for better attribution of wakeup
events.
The logic for encoding the data in the prefix is still maintained ad-hoc
and should be standardized in the future.

Test: Builds, boots. Manually triggering a wifi wakeup doesn't result
in anything unexpected.
Test: atest FrameworksNetTests

Bug: 265742148
Change-Id: I7ef8a606459bb9f0630f629c01d3b34643ae5319
2023-02-28 19:18:44 +00:00
Yuyang Huang
96e8bfee5f Check network slicing declaration for network request
When the application wants to request network with
NET_CAPABILITY_PRIORITIZE_BANDWIDTH or
NET_CAPABILITY_PRIORITIZE_LATENCY, it has to declare
PackageManager.PROPERTY_NETWORK_SLICE_DECLARATIONS property and also
adds the declaration in a separate XML files. Otherwise, the request
will fail with a SecurityException being thrown.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 266524688
Change-Id: I6affc857b803211517368da288e1b2fdc06a955b
2023-02-28 17:38:30 +09:00
Kangping Dong
7dc4459d33 Merge "add TRANSPORT_THREAD to NetworkCapabilities" 2023-02-28 07:16:16 +00:00
Treehugger Robot
ea5e220c90 Merge "Address comments at aosp/2361702" 2023-02-23 11:07:03 +00:00
Junyu Lai
c53a169a90 Address comments at aosp/2361702
Test: 1. Patch local built module on T device
      2. atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Fix: 267968887
Change-Id: I86e5be9a0cee0621ff9ef0996d56a51fc5f408c2
2023-02-23 15:21:29 +08:00
Chiachang Wang
bf8b243978 Merge "Add test for using ESP_IP_VERSION and ESP_ENCAP_TYPE in Vpn" 2023-02-22 05:58:02 +00:00
Treehugger Robot
3bee8c9afa Merge "Fix a bug where alarms are deduplicated" 2023-02-22 04:08:47 +00:00
Chalard Jean
f4eb1ae6b9 Fix a bug where alarms are deduplicated
Test: new test in this patch
Bug: 269719647
Change-Id: I32e8d35f1751e2fd81a0007ae6cb308b6bcbb463
2023-02-22 03:00:46 +09:00
chiachangwang
84ea53691c Add test for using ESP_IP_VERSION and ESP_ENCAP_TYPE in Vpn
Bug: 269714344
Test: atest FrameworksNetTests
Change-Id: Ia9c47967a1b96204a6a739d133f2b8455229af52
2023-02-21 11:31:28 +00:00
Chalard Jean
e4341f0933 Update VpnTests for adding ESP arguments
Test: VpnTest
Bug: 269714344
Change-Id: I0d8a2818ea0b67ebb5da7dbac9cd6aea9bede386
2023-02-21 05:59:52 +00:00
Lucas Lin
1e9120a863 Merge "Fix flaky test testRestrictedProfileAffectsVpnUidRanges" 2023-02-18 06:19:26 +00:00
lucaslin
881daf084f Fix flaky test testRestrictedProfileAffectsVpnUidRanges
File a VPN request to prevent the VPN network being lingered.

The VPN network will be lingered and onCapabilitiesChanged()
will be fired when the linger timer is expired, which will
cause the test receiving an unexpected onCapabilitiesChnaged()
and make the test failed eventually.

Bug: 265396507
Bug: 265510523
Test: atest FrameworksNetTests
Change-Id: Id9ad810d46cb2bbb13fa5c602520635ae8e73e31
2023-02-18 02:59:05 +00:00
Treehugger Robot
4e1695f711 Merge "Enable automatic keepalives by default." 2023-02-17 23:53:00 +00:00
Chalard Jean
759fbc7f3d Enable automatic keepalives by default.
This can still be flagged off.

Test: FrameworksNetTests
Change-Id: Ic69911d21da380662a65f1c482ccee107f851a23
2023-02-17 15:37:57 +09:00
Motomu Utsumi
6c01bd30af Merge "Add getUidRule method to BpfNetMaps" 2023-02-17 01:52:52 +00:00
Benedict Wong
78dea027ff Merge "Add unit tests for new VpnProfile fields" 2023-02-15 23:42:51 +00:00
Quang Luong
0f6a2e69cd Merge "Allow SUW to access registerSystemDefaultNetworkCallback" 2023-02-15 20:22:10 +00:00
chiachangwang
015b68b192 Add unit tests for new VpnProfile fields
Add and update tests for automaticNattKeepaliveTimerEnabled
and automaticIpVersionSelectionEnabled fields.

Test: atest Ikev2VpnProfileTest VpnProfileTest
Change-Id: I4e424abd2197d9099a2efe0bd8c4b9120bfcfe3a
2023-02-15 15:01:28 +00:00
chiachangwang
7c17c283ea [DK5]Add debugging information for automaticOnOff keepalive
Print state and keepalive information in the dump.

Also update ConnectivityService and the corresponding test to
create AutomaticOnOffKeepaliveTracker from a Dependencies class.
ConnectivityService#dump() will require READ_DEVICE_CONFIG
permission because of the new dump() in AutomaticOnOffKeepaliveTreacker.
ConnectivityServiceTest should focus on verifying design in
ConnectivityService, so skipping the DeviceConfig check via a fake
Dependencies class in the unit test.

Sample dump:

AutomaticOnOff enabled: true
  AutomaticOnOffKeepalive [KeepaliveInfo [ type=1 network=100 startedS ... ], state=STATE_ENABLED ]

Bug: 259000745
Test: m ; atest FrameworksNetTests CtsNetTestCases
Change-Id: I9ac725bcef7daec1d1a12bad592b7fa6856a1707
2023-02-13 09:54:36 +00:00
Jean Chalard
d500f20f90 Merge "Remove expectLinkPropertiesThat" 2023-02-11 02:09:38 +00:00
Quang Luong
98858d6b27 Allow SUW to access registerSystemDefaultNetworkCallback
registerSystemDefaultNetworkCallback is required by WifiTrackerLib to
detect the system default network for UI purposes. Currently this API is
allowed for holders of the NETWORK_SETTINGS permission, but not
NETWORK_SETUP_WIZARD. Since SUW also uses WifiTrackerLib, we should
allow this API for NETWORK_SETUP_WIZARD as well.

Bug: 230643853
Test: atest ConnectivityServiceTest
Change-Id: Ic01a186f91ed67b4603b6b8964921be7473a483a
2023-02-11 00:31:59 +00:00
Aaron Huang
2a69e41772 Merge "Tempates with different subscriber ID should be not equal" 2023-02-10 08:06:07 +00:00
Aaron Huang
c9371d05fe Tempates with different subscriber ID should be not equal
mSubscriberId was removed from NetworkTemplate and equals/hashCode
does not check the mMatchSubscriberIds. This will cause tempates
with different subscriber ID matching that are equal now. Thus
adding the check for mMatchSubscriberIds to fix it.

Bug: 267968247
Test: FrameworksNetTests:NetworkTemplateTest
Change-Id: I2956bf4c8cf2c4d73ebe102d53e755fbcc5d7642
2023-02-10 08:04:53 +00:00
Chalard Jean
816f0af86a Remove expectLinkPropertiesThat
expect() is simply better

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: I5bf109ccf34f1fa5ce2f4ed78300d5a126778e30
2023-02-10 14:32:14 +09:00
Jean Chalard
9f3857754d Merge changes from topics "remove_expectblocked", "rename_reason"
* changes:
  Rename BlockedStatusInt.blocked to .reason
  Remove expectBlockedStatusCallback
2023-02-10 05:26:50 +00:00
Yuyang Huang
90a2cbdd8d Moves all compatibility flags to ConnectivityCompatChanges.java
ConnectivityCompatChanges.java becomes the centralized place for all the
CompatChanges used in the Connectivity module. By putting all the
CompatChanges here, we are able to manage them under a single
platform_compat_config.

Bug: 268440216
Test: atest FrameworksNetTests
Change-Id: I3e17af545718073d7d1c96e27298e7790563fd33
2023-02-09 19:51:37 +09:00
Chalard Jean
9d8397a87a Rename BlockedStatusInt.blocked to .reason
It's a reason, so it's a lot clearer this way

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: I1cfcdb291f46205141d5d40322d5a8e3b178db20
2023-02-09 16:19:14 +09:00
Chalard Jean
6486ca58fc Remove expectBlockedStatusCallback
expect() is simpler to do the same thing

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: I4d992fd7ea57d36a38afc33eaebcf2f7ce05aa80
2023-02-09 16:19:14 +09:00
Jean Chalard
2a6c2e0160 Merge "Remove expectCapabilitiesWith and Without" 2023-02-09 02:20:20 +00:00
Lorenzo Colitti
5d8c3b1428 Merge changes from topic "experimental-udp-encap"
* changes:
  Experimental support for IPv6 UDP encap.
  Remove unused assignment.
  Refactor testCreateTransform and add IPv6 and encap coverage.
2023-02-08 06:06:17 +00:00
Lorenzo Colitti
b38fef8333 Experimental support for IPv6 UDP encap.
This is a back-pocket solution only, to ensure that VpnManager
privileged clients can temporarily rely on IPv6 UDP encap if on
certain carriers IPv4 UDP and IPv6 ESP cannot provide acceptable
performance and battery life.

For these reasons IPv6 UDP encap is not a public or system API
and is triggered by passing a port greater than 65535 to the
existing openUdpEncapsulationSocket API.

Bug: 259001350
Test: new CTS tests
Change-Id: I02e0566ba910a300dda6a589cd265a3360add40c
2023-02-08 15:05:07 +09:00
Chalard Jean
99cab4a44c Remove expectCapabilitiesWith and Without
The base method is capable of doing this in a clearer manner,
so this redundant method is no longer needed.

Test: ConnectivityServiceTest FrameworksNetIntegrationTests
Bug: 157405399
Change-Id: I5f801d3c66374096fe7be7be21ee8d80264cd693
2023-02-07 18:17:33 +09:00
Jean Chalard
f1aeb1051e Merge "Remove expectCapabilitiesThat" 2023-02-07 03:20:05 +00:00
Aaron Huang
40eb6abb07 Merge "Combine two register broadcast receiver methods into one method" 2023-02-07 03:06:37 +00:00
Paul Hu
e3e9f5622b Merge "Rename onResolveStopped to onResolutionStopped" 2023-02-06 11:16:48 +00:00
Aaron Huang
9e04018e8c Combine two register broadcast receiver methods into one method
Combine registerPacProxBroadcastThat and registerConnectiviyBroadcastThat
into one method since they are highly similar.

Test: FrameworksNetTests:ConnectivityServiceTest
Change-Id: If0605a94208478399375a43c1ef92782d26cb805
2023-02-06 19:04:01 +08:00
Aaron Huang
c6d0770afc Merge "Make sure device is awake to verify the launcher is shown" 2023-02-06 06:47:23 +00:00
Aaron Huang
361e617b93 Make sure device is awake to verify the launcher is shown
If the screen is off while running the test, it will
cause test fail because the test cannot verify the
launcher is shown. Thus, wake up the device first to
verify if the launcher is shown or not.

Bug: 261860642
Test: this
Change-Id: Icda8a2c6fdc97caf1986bb812ca366d9c9fde03f
2023-02-06 12:13:26 +08:00
Chalard Jean
c030aebe86 Remove expectCapabilitiesThat
expect() does the job better.

Test: FrameworksNetTests
Bug: 157405399
Change-Id: Ibb8fa432318cd2c37b23947a33c0e806111d099f
2023-02-03 23:40:25 +09:00