Commit Graph

2001 Commits

Author SHA1 Message Date
Lorenzo Colitti
22941b38f7 Don't add LOCAL_NETWORK as forbidden capability
This causes the module to crash on rollback because the current
production code does not consider LOCAL_NETWORK to be a valid
capability.

Change-Id: Idf57d72c384b41b483098c4c302738072ebf7f90
Test: TH
Fix: 313030307
2023-12-13 11:24:25 +09:00
Yan Yan
96db51b377 Merge "[XFRM_MSG_NEWSA] Support polling SA state with netlink message" into main 2023-12-11 23:27:17 +00:00
Yan Yan
4df361975d [XFRM_MSG_NEWSA] Support polling SA state with netlink message
Bug: 308011229
Test: IpSecXfrmControllerTest
Change-Id: Id765cd8d8d7e330969877cb0890bd828417fb6b8
2023-12-11 18:43:34 +00:00
Junyu Lai
5ad399d8c3 Merge "[BR14] Tracker Data Saver status in ConnectivityService" into main 2023-12-11 10:09:57 +00:00
Junyu Lai
38c7503ab5 [BR14] Tracker Data Saver status in ConnectivityService
BYPASS_INCLUSIVE_LANGUAGE_REASON=Using public API
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSBpfNetMapsTest
      (on U and V devices respectively)
Bug: 297836825
Fix: 314858283

Change-Id: Ibeac8cd3a33468c6539234255328affc6b3f8ffe
2023-12-08 13:54:29 +08:00
Paul Hu
516e27f9c3 Replace MdnsPointerRecord contructor usage for queries
This is a test only change, replacing the MdnsPointerRecord
constructor usage for queries with the new version.

Bug: 312657709
Test: atest FrameworksNetTests
Change-Id: Ie9e51df78bfc27090503b861c5ac979201f10608
2023-12-07 08:38:48 +00:00
Yang Sun
38795d6f89 Merge "Add support for setsockoptBytes" into main 2023-12-05 07:35:02 +00:00
Hansen Kurli
997bb6c79e Merge "Remove unused Vpn Dependency methods in VpnTest." into main 2023-12-04 05:23:06 +00:00
Yang Sun
f2987b8bf8 Add support for setsockoptBytes
Test: atest FrameworksNetTests:android.net.connectivity.android.net.NetworkUtilsTest
Change-Id: I3d94172fa8a42e2ab8ba4caf80d5caaa11fac703
2023-12-04 09:02:45 +08:00
Yuyang Huang
283ff70585 Merge "Add support to update the registered service in place" into main 2023-12-02 08:49:23 +00:00
Yuyang Huang
e5cba9cb87 Add support to update the registered service in place
The current implementation of MdnsAdvertiser doesn't support updating an
existing registration. For an update request, the client needs to
unregister it first, which will trigger an exit message and then
register again, which will trigger an announcement message. There are
some clients that don't want to trigger the exit and announcement
message every time. This CL adds the API to support that use case.

Bug: 309372239
Test: TH
Change-Id: Iabe69a987a11104090082e01969e7595f05504e8
2023-12-01 18:15:58 +09:00
Yuyang Huang
4c969a65ae Merge "Update registerOffloadEngine() permission check" into main 2023-11-30 05:57:02 +00:00
Yuyang Huang
8670809d7f Merge "Log bpf rc file if it differs from the template files." into main 2023-11-30 03:32:56 +00:00
Yuyang Huang
41557553f6 Log bpf rc file if it differs from the template files.
Check if the bpf loader rc file is differs from the template files when
ConnectivityService starts. Use Log.wtf() to log the file if there is a
diff.

Bug: 312638861
Test: TH
Change-Id: I0b9ed9962ad0954a051a17b01357d04a0e655ff4
2023-11-29 19:58:15 +09:00
Yuyang Huang
d5896e7721 Update registerOffloadEngine() permission check
Update registerOffloadEngine() permission check to check the
DEVICE_POWER permission in U. This change is required to allow the
android TV device to access the API in U because the
REGISTER_NSD_OFFLOAD_ENGINE permission can not be backported.

Bug: 313546516
Test: TH
Change-Id: I84b80d102a34487ad54719a86eb525b319e2fd8b
2023-11-29 13:38:40 +09:00
Mike Yu
9738b47758 Replace useTls with mode in PrivateDnsConfig
In PrivateDnsConfig class, `useTls` is replaced with `mode`.
This CL a corresponding change.

Bug: 240259333
Test: atest ConnectivityCoverageTests
Change-Id: I60c53e52f287fc7fa05543603a62632d934bb2e6
2023-11-28 07:49:58 +00:00
Hansen Kurli
b27602c8d9 Remove unused Vpn Dependency methods in VpnTest.
Vpn.Dependencies contains methods used for legacy VPNs that are
now unused. Remove them.

Bug: 161776767
Test: atest FrameworksNetTests
Change-Id: I68bbb3e519f5558f9006f680df79ae8073e196cd
2023-11-28 15:49:14 +08:00
Remi NGUYEN VAN
5db2089717 Merge "Prompt user to add data on mobile portals" into main 2023-11-27 02:45:14 +00:00
Jean Chalard
11162e97c6 Merge "Revert "Prioritize non-slices over slices"" into main 2023-11-24 02:50:35 +00:00
Remi NGUYEN VAN
3f2ff2e3d7 Prompt user to add data on mobile portals
On mobile networks it is more likely that the user needs to top up or
get a mobile data subscription, rather than "sign in" as the previous
messaging was suggesting.
Following feedback from interaction designers / UX writers, change the
strings to be more appropriate for the most common use-case.

Bug: 153673376
Test: atest FrameworksNetTests
      manual test on mobile network force-detecting a portal.
Change-Id: I5b4d4a17fd507d8cf3c9863cf23b5fedb258852e
2023-11-24 11:02:19 +09:00
Paul Hu
976e52a2c4 Merge "Add Thread#join to guarantee the termination of the thread" into main 2023-11-22 06:22:23 +00:00
Paul Hu
005fb887e6 Merge "Fix the memory leak in nsd tests" into main 2023-11-22 02:57:24 +00:00
Mike Yu
faa10d066b Merge "Update Andorid.bp to use DnsResolver v13" into main 2023-11-21 12:04:30 +00:00
Jean Chalard
6121a7656c Revert "Prioritize non-slices over slices"
This reverts commit 14499f0119.

Reason for revert: b/312408745

Change-Id: I8b03799fe6e0e256263240909ee7446c178bf508
2023-11-21 10:25:14 +00:00
Paul Hu
0788d8ee7e Add Thread#join to guarantee the termination of the thread
Also add MonitorThreadLeak annotation to check thread leak.

Test: atest ConnectivityCoverageTests --test-filter mdns*
Change-Id: Ie47f30360e36784428173f6cc87a4a6b09826405
2023-11-21 16:08:41 +08:00
Paul Hu
27662f0cc3 Fix the memory leak in nsd tests
The NsdManager constructor creates a new thread, which is not
intended to be closed. However, the test in NsdMangerTest and
NsdServiceTest create a new NsdManager instance, resulting in a
large number of threads running during the tests. This can lead
to an out-of-memory error for the tests. To resolve this issue,
use the common singleton thread ConnectivityThread to handle
tasks from the various instances.

Fix: 308544734
Test: atest ConnectivityCoverageTests --test-filter Nsd*
Change-Id: I1908a2bb1bd20da8e0498353bca26f7e89e16626
2023-11-21 14:04:07 +08:00
Jean Chalard
4a013c47c2 Merge changes I30f8814c,Ifdf67318,If312b8f8 into main
* changes:
  Rename hasCarrierPrivilege... to isCarrierServiceUid...
  Detect discrepancies in subIds
  Allow carrier service UIDs to access their own WiFi networks.
2023-11-20 06:55:04 +00:00
Chalard Jean
96ff954464 Stop CarrierPrivilegeAuthenticator thread in tests
Bug: 308519360
Test: CarrierPrivilegeAuthenticatorTest
Change-Id: I59164be00a9e1fcced8538537c1dcabd214f2170
2023-11-20 14:31:32 +09:00
Chalard Jean
8c63ed851f Rename hasCarrierPrivilege... to isCarrierServiceUid...
This method tests whether the UID is the carrier service
UID, not whether the UID has carrier privilege.

Note that in normal operation, the carrier service UID always
has carrier privilege.

Test: NetworkAgentTest
Change-Id: I30f8814cc0419a2d6bdbe75fdc82156516eba026
2023-11-20 14:01:02 +09:00
Chalard Jean
a093b452f3 Allow carrier service UIDs to access their own WiFi networks.
Bug: 236669534
Test: New tests in this patch
Change-Id: If312b8f8359888558969c022811d6b203be602a0
2023-11-20 14:01:02 +09:00
Jean Chalard
51c80a72d8 Merge "Add more powerful CTS for allowedUids" into main 2023-11-20 04:44:22 +00:00
Chalard Jean
5301778ad8 Add more powerful CTS for allowedUids
This tests that the network providers are subject to appropriate
limitations as to what they can set as allowedUids – both in the
positive (can do) case, and the negative (can't do) case.

Test: this
Change-Id: I115e2a4bc02ddcd03ecf2f35130fcb0378da22bd
2023-11-20 12:16:39 +09:00
Mike Yu
d0ad17c2d1 Update Andorid.bp to use DnsResolver v13
Bug: 240259333
Test: atest ConnectivityCoverageTests
Change-Id: I92ab5e1eef7ba1715176e3628222084067d14603
2023-11-20 01:48:53 +00:00
Michał Brzeziński
dec578072a Merge "Revert "Make PRIORITIZE_* networks non-default"" into main 2023-11-17 12:21:56 +00:00
Michał Brzeziński
05cba24cd8 Revert "Make PRIORITIZE_* networks non-default"
This reverts commit 30fb9b1ca4.

Reason for revert: Potential culprit for CtsLibcoreTestCases test failures b/311612650

Change-Id: Ie7de97159f92a174476a8fa8ea83e3e01914aea1
2023-11-17 11:18:56 +00:00
Chiachang Wang
35c1bc4fbb Merge "Update test as the parameters are removed from production code" into main 2023-11-17 08:55:12 +00:00
Jean Chalard
9a5252ba50 Merge "Make PRIORITIZE_* networks non-default" into main 2023-11-17 05:55:22 +00:00
Chiachang Wang
a34e045610 Update test as the parameters are removed from production code
Bug: 161776767
Test: atest FrameworksNetTests
Change-Id: Id2cef626c5893a4ff29161c801e497b7de551136
2023-11-17 01:25:22 +00:00
Hansen Kurli
77f9fb300f Merge "Test VpnProfile is not modified in startLegacyVpn" into main 2023-11-16 10:04:19 +00:00
Chalard Jean
30fb9b1ca4 Make PRIORITIZE_* networks non-default
As a specialized network, a network with PRIORITIZE_* is not
generally a good default network, and might cause unexpected
charges if allowed to become one.

Test: CSDefaultNetworkTests
Change-Id: I8f7184f80bb987da720bd067862bd7a546a38e26
2023-11-16 18:45:10 +09:00
Chiachang Wang
dff6b91649 Merge "Add test for verifying if setVpnDefaultForUids() is called correctly" into main 2023-11-16 06:16:11 +00:00
Jean Chalard
cc2e72735d Merge "Use FromS() on LocalNetworkConfig" into main 2023-11-16 04:45:15 +00:00
Hansen Kurli
e949124bcc Test VpnProfile is not modified in startLegacyVpn
The profile is modified within startLegacyVpnPrivileged(), e.g.
ipsecCaCert, ipsecUserCert. This causes subsequent calls from
callers such as LockdownVpnTracker to fail.

Add a new test to ensure the VpnProfile is not modified in
startLegacyVpn.
Add testClone in VpnProfileTest.

Bug: 190572822
Bug: 309591931
Test: atest FrameworksNetTests, test before and after fix.
Test: Manual test
Change-Id: Id090e0dd3b9e74a7461ae90e68c41e802b458744
2023-11-16 12:28:12 +08:00
lucaslin
cca1652bdb Add test for verifying if setVpnDefaultForUids() is called correctly
This commit verifies that
- If VPN network preference is set when
    - Ikev2VpnRunner is created
    - Retrying VPN
    - Updating exclusion list
- If VPN network preference is cleared when
    - Exiting VPN runner
    - NOT_RECOVERABLE happens

Bug: 231749077
Test: atest FrameworksNetTests:VpnTest
Change-Id: I71f48f18fd4556e04c131d5939afaa1ef5a0f814
2023-11-16 12:03:13 +08:00
Junyu Lai
d3447a1d52 Merge "[BR11] Read data saver status from bpf" into main 2023-11-16 02:57:55 +00:00
Chiachang Wang
9481063d42 Merge "Pass VPN uid range to AutomaticOnOffKeepaliveTracker" into main 2023-11-16 01:30:48 +00:00
Motomu Utsumi
1cd89fca86 Merge changes from topic "multi_network_activity_tracking" into main
* changes:
  Make ConnectivityService update BatteryStats radio power state
  Track multiple network activities on V+
  Use netId as idleTimer label on V+
2023-11-15 13:58:37 +00:00
Chiachang Wang
59bcabe3f4 Pass VPN uid range to AutomaticOnOffKeepaliveTracker
This is a preliminary change for filtering sockets that is not
in the uid ranges for automatic on/off keepalives. This commit
itself is a no-op change to pass the uid information to
AutomaticOnOffKeepaliveTracker.

Bug: 311119352
Test: atest FrameworksNetTests
Change-Id: I7d96e7a0d3f3054d1409de350420a24378b28cdb
2023-11-15 08:50:27 +00:00
Junyu Lai
c7126bb997 Merge "Ensure no thread leak after NetworkStatsServiceTest" into main 2023-11-15 07:45:34 +00:00
Chalard Jean
b86a574fe9 Use FromS() on LocalNetworkConfig
Like NetworkScore, this object is not available on R because
of the absence of the tethering module. Therefore it needs to
be wrapped to be protected against introspection by the test
libraries.

Change-Id: Ia5f84d2926433398cef33d89819a8c6588024ea0
Test: FrameworkNetTests
2023-11-15 16:27:19 +09:00