Commit graph android_packages_modules_Co.../tests/unit/java
Message SHA1
Support multicast routing
Added support to apply multicast routing config between network
interfaces in MulticastRoutingCoordinatorService.

Bug: 281217735

Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.connectivity.MulticastRoutingCoordinatorServiceTest

Change-Id: If608b79d4e62a20d2e01755a83a901f6e274d9a2

Yang Sun   commited 2024-01-20 21:32:11 +08:00
baa50fa478
Merge "Use MonitorThreadLeak in ConnectivityService tests" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-01-12 06:48:51 +00:00
c45efc312e
Merge "Revert "Implement NetworkRequestsState atom"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-01-12 05:18:49 +00:00
a8062d9ed0
Merge "Fix leak of NetworkAgentWrapper HandlerThread" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-01-11 10:33:21 +00:00
64a8ead5d1
Use MonitorThreadLeak in ConnectivityService tests
Fix current leaks in ConnectivityServiceIntegrationTest, which leaked
the ConnectivityService and CarrierPrivilegeAuthenticator handler
threads, and enable the checks.

Using @DevSdkIgnoreRunner.MonitorThreadLeak ensures that tests properly
cleanup threads (in particular handler threads), as many leaked threads
could affect other tests.

Bug: 310659032
Test: atest --rerun-until-failure 20
Change-Id: Ia62d33d86217fef1d03532bb51c890a90430a70e

Remi NGUYEN VAN   commited 2024-01-11 19:19:13 +09:00
de0b07b46e
Fix leak of NetworkAgentWrapper HandlerThread
ConnectivityServiceTest creates hundreds of NetworkAgentWrapper, without
stopping their HandlerThread. This leaks a lot of threads while tests
are running.

Ensure the threads are stopped in ConnectivityServiceTest, and
integration tests that also use NetworkAgentWrapper.

Test: atest, watch adb shell ps -T [test package pid]
Bug: 310659032
Change-Id: I34f367b2efe3d05e1db5eab4c9fd93ee79c1b683

Remi NGUYEN VAN   commited 2024-01-11 17:59:29 +09:00
2491624106
Merge "Migrate Tethering#dump to use runWithScissorsForDump" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-01-10 09:46:12 +00:00
7b4ebdf2ef
Migrate Tethering#dump to use runWithScissorsForDump
This change includes:
  1. Refactor the logic in Tethering#dump into utils class.
  2. Move the utils class to a common place which could be referenced
     from other sub-modules.
  3. Add @MonitorThreadLeak annotation to enforce
     there is no thread leak problem.

Test: atest FrameworksNetTests NetworkStaticLibTests
Test: atest ConnectivityCoverageTests:com.android.networkstack.tethering.TetheringTest#testDumpTetheringLog
Test: adb shell dumpsys tethering (with hardcoded exception)
Fix: 312669345

Change-Id: Ia6fdfeeec2110afa0ec9e056e9db3843748845c3

Junyu Lai   commited 2024-01-10 13:56:55 +08:00
2ff42d264b
Revert "Implement NetworkRequestsState atom"
This reverts commit e3245081b1.

Reason for revert: The change is unsafe as it introduces code with writings to a separate thread whose message queue size is unlimited.
Test: atest FrameworksNetTests

Change-Id: I392a30f77cfbcd17f420e29f0944604fd789b10a

Danuta Brotikovskaya   commited 2023-12-28 18:19:20 +00:00
2971ffc776
Merge "Change throw to Log.wtf" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-12-28 01:40:10 +00:00
ab2fd4cac9
Stop registering native mdns service
NsdService switched from Netd native solution to Java solution on
Android U. MDNS service provided by Netd will be removed from Android V.

1. Stop registering native mdns service from V.
2. Stop startDaemon() in NsdManager from V.
3. As a double safety, return early in NsdService methods that call the
   native mdns service when platform version is V+.
4. Modify NsdManagerTest to cover V+ behavior.

Bug: 298594687
Test: Build. Presubmit.
Change-Id: Ifdac8f7a44aa57d93d453ba482ec473a2b531452

Ken Chen   commited 2023-12-27 13:54:50 +00:00
80c9f6f35f
Merge changes from topic "fix-mdns" into main
* changes:
  [mdns] add tests for verifying address of mDNS reply
  [mdns] fix wrong NSEC answer for unique RRs
  [mdns] fix duplicated records for multiple questions

Kangping Dong   authored and   Gerrit Code Review   commited 2023-12-27 13:15:30 +00:00
81e6439298
Change throw to Log.wtf
Log.wtf should avoid crashes, while making sure that one can still
notice if there is a problem.

In particular, it may be possible that calling ensureIpServerStopped
and ensureIpServerStarted could start forwarding before the previous
IpServer has stopped it.

Bug: 314260975
Change-Id: I047a673d2fe6f218192d3144fa0bd60ce8739a15
Test: TH

Remi NGUYEN VAN   commited 2023-12-27 19:31:54 +09:00
ca3c524b49
[mdns] add tests for verifying address of mDNS reply
Bug: 265095929
Test: atest FrameworksNetTests
Change-Id: I3499fb9dfc24fec9648f9c97d6028c3fca4f925a

Kangping Dong   commited 2023-12-27 16:54:18 +08:00
b83b90e779
[mdns] fix wrong NSEC answer for unique RRs
Existing MdnsRecordRepositiry#getReply will send a NSEC RR in the reply
when 1) a query for a unique RR is not found or 2) any unique name which is
included in the answer sections. The second one is not aligned with the
spec:

```
On receipt of a question for a particular name, rrtype, and rrclass,
for which a responder does have one or more unique answers, the
responder MAY also include an NSEC record in the Additional Record
Section indicating the nonexistence of other rrtypes for that name
and rrclass.
```

This commit fixes the issue in 2) by checking that all unique records of
the name are included in the answers before adding a NSEC record.

Bug: 265095929
Test: atest FrameworksNetTests
Change-Id: I0531fbccf98e69a50bb8a45e529caaed3ad80b59

Kangping Dong   commited 2023-12-27 16:54:15 +08:00
04b61c4a3c
Merge "Introduce NsdManager API for in-place service updates without re-announcement." into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-12-27 08:26:54 +00:00
8c22b9a37c
Merge "[AF03] Adopt FastDataInput" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-12-26 09:15:02 +00:00
713fc49cdb
[AF03] Adopt FastDataInput
FastDataInput for reading persistent data is currently disabled
by default. This functionality will be gradually enabled through
A/B experiments to assess its impact.

One-shot boot time increase up to 10 second is one expected
outcome in worst case. Currently, the persistent data was loaded
when the first caller query it, but in this change it will be
done twice in the boot stage due to the needs of doing comparison.

Test: adb shell dumpsys netstats
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Test: manual test against data points under benchmark/assets/dataset
Bug: 313841499

Change-Id: Ia927bd115de5453ca3ee22104f3efbf44a55c2b8

Junyu Lai   commited 2023-12-26 15:42:09 +08:00
da6020a329
Merge "Check target sockets by UID range" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-12-26 06:19:17 +00:00
34afa7b73c
Check target sockets by UID range
This commit optimizes the mechanism to examine the TCP sockets
based on the VPN UID range.

The automaticOnOffKeepalives will be paused/resumed by checking
the TCP sockets status on the VPN network. The existing design
considers all UIDs, not the UID ranges for the specific VPN
network. This may lead to an inaccurate judgement to not to
stop the keepalive even when there is no socket on the VPN
network.

This commit is also a part of follow-up work from aosp/2354202
to use structized class to parse the TCP sockets.

Bug: 311119352
Bug: 265877161
Test: atest FrameworksNetTests
Change-Id: I4a6b751cb904b9c18ed1df420cc880ea38022d6a

Chiachang Wang   commited 2023-12-26 05:22:00 +00:00
d8474bb1cf
Merge "[AF08] Fill useFastDataInput metrics" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-12-26 04:58:08 +00:00
9d962db18b
Merge "[AF06] Fill file attributes metrics" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-12-26 04:34:05 +00:00
46afd1b4cb
Introduce NsdManager API for in-place service updates without re-announcement.
This commit builds upon CL aosp/2817455 by adding a new NsdManager API to
update registered services directly, eliminating the need for exit and
re-announcement messages. This preserves compatibility with existing
apps without requiring an API bump. If an app registers a service with
the same listener and NsdServiceInfo, it's treated as an update request.

Bug: 309372239
Test: TH
Change-Id: Ib84ddf0d92e757eaef225f3e32f5223bc50c8fd6

Yuyang Huang   authored and   Remi NGUYEN VAN   commited 2023-12-26 13:09:00 +09:00
86d083f3a4
[AF08] Fill useFastDataInput metrics
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsRecorderTest
Bug: 313841499
Change-Id: I3bd44c9e0fe9eab55b9e2360d80b3bbe2156cc3f

Junyu Lai   commited 2023-12-26 03:38:48 +00:00
f978f5366a
Merge "[AF05] Fill NetworkStatsRecorderFileReading metrics" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-12-26 02:29:56 +00:00
59583789e9
Merge "Add MdnsReplySenderTest" into main
Paul Hu   authored and   Gerrit Code Review   commited 2023-12-25 08:25:21 +00:00
1cbb9ab59f
Merge "Correct coding format" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-12-25 07:00:41 +00:00
32350ca201
Add MdnsReplySenderTest
Currently, the MdnsReplySender doesn't have a dedicated test
class to verify its functionality. To address this gap, add the
MdnsReplySenderTest class, which can test all methods within the
MdnsReplySender class.

Bug: 312657709
Test: atest FrameworksNetTests
Change-Id: Ibd948d97d38c012c63092ed4c6877d04b1ff14c1

Paul Hu   commited 2023-12-25 14:23:41 +08:00
0228e63a45
[mdns] fix duplicated records for multiple questions
Existing MdnsRecordRepositiry#getReply will result in duplicated RRs in
answer and additional records sections if multiple PTR questions for the
same service are received in a single query message.

This commit fixes this by using a Set<> for maintaining the RR set and
moving the NSEC construction to outer of the addReplyFromService() after
all answer and additional records have been added.

This commit also refactors the unit tests to cover more cases of
multiple queries other than PTR records

Bug: 265095929
Change-Id: I379dd89703915406c5700ed19aad46ef4035b917

Kangping Dong   commited 2023-12-25 13:59:41 +08:00
0c374445dc
Correct coding format
A clean up commit to correct the coding format.

Test: atest FrameworksNetTests
Change-Id: I7d7ed3765a0be503400ed3c33ea461e9baa3e72d

Chiachang Wang   commited 2023-12-25 05:55:29 +00:00
4823f0fb4d
[AF06] Fill file attributes metrics
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsRecorderTest
Bug: 313841499

Change-Id: I12759e14c29917ad61eedad4cfee21f153a1a6bd

Junyu Lai   commited 2023-12-25 10:39:59 +08:00
ed1097b733
[AF05] Fill NetworkStatsRecorderFileReading metrics
By verifying with benchmark tests, this does not have significant
change on file reading performance.

Test: atest ConnectivityBenchmarkTests
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsRecorderTest
Bug: 313841499
Change-Id: I161a101dcec82fdaa70128541f9e153bac484ecc

Junyu Lai   commited 2023-12-25 10:34:59 +08:00
e38aa1be80
Merge "[AF02.1] Support read by FastDataInput in the NetworkStatsRecorder" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-12-25 01:58:14 +00:00
962515a8a8
Merge "Support mDns Known-Answer Suppression" into main
Paul Hu   authored and   Gerrit Code Review   commited 2023-12-22 08:32:29 +00:00
0db97a6f93
Merge "Implement NetworkRequestsState atom" into main
Danuta Brotikovskaya   authored and   Gerrit Code Review   commited 2023-12-21 18:02:50 +00:00
0d8a980059
Implement NetworkRequestsState atom
Bug: 278833398
Test: atest FrameworksNetTests
Change-Id: Ie83bf49693411e4c3f629c07d98071505f48c08f

Danuta Brotikovskaya   commited 2023-12-21 15:56:03 +00:00
e3245081b1
[AF07] Make subclass of NetworkStatsService#Dependencies in the tests
This is a no-op refactoring that make a subclass of
NetworkStatsService#Dependencies in order to make the
follow-up changes can implement private getters in the
class and easier to review.

Test: TH
Bug: 313841499
Change-Id: If0de525b32abb9ad715c633f42b3c65c0d720d24

Junyu Lai   commited 2023-12-21 10:38:15 +00:00
16936828a0
[AF02.1] Support read by FastDataInput in the NetworkStatsRecorder
This increased reading performance by 35% while running
benchmark tests. But the feature is not enabled in the production
code until the service turns it on.

Test: atest ConnectivityBenchmarkTests
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.NetworkStatsCollectionTest
Bug: 313841499

Change-Id: Ic827e6c4848cc31d46d62aa93993b483114a1f12

Junyu Lai   commited 2023-12-21 15:14:59 +08:00
2dce848e88
Merge "Add multi-subtype support to NsdService" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2023-12-20 06:38:25 +00:00
e945c3c28e
Merge "Remove sdk level check when calling getDataSaverEnabled" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-12-20 03:01:08 +00:00
9c15ff7704
Add multi-subtype support to NsdService
Allow client to register multi-subtype using comma separate format like:
"_997._tcp,_test1,_test2,_test3"

Bug: 315085895
Test: TH
Change-Id: Ibd27e42cb9e7a0274d1d8df3f6f3a00786e4a237

Yuyang Huang   commited 2023-12-19 15:53:36 +09:00
170d42f15c
Support mDns Known-Answer Suppression
Support the RFC 6762 section 7.1. Known-Answer Suppression.
If the response contains an answer that is also present in the
answer section and the known-answer's TTL is greater than half
of the original TTL, suppress the response.

Bug: 312657709
Test: atest FrameworksNetTests NsdManagerTest
      Passed DUPLICAE SUPPRESSION test case of BCT
Change-Id: I1890e9fba068c1f59a1d93c3514f0e7d07da1814

Paul Hu   commited 2023-12-19 02:18:53 +00:00
01f243f5a8
Merge changes from topic "mdns-subtypes" into main
* changes:
  [mdns] add service-side impl for subtypes advertising
  [mdns] add support for advertising subtypes

Kangping Dong   authored and   Gerrit Code Review   commited 2023-12-18 08:49:44 +00:00
19d055514c
Remove sdk level check when calling getDataSaverEnabled
Follow-up from aosp/2856948, the data saver status value is
filled by ConnectivityService before Android V. Thus, calling
BpfNetMapsReader#getDataSaverEnabled() is a legit use case, which
should not trigger log.wtf.

Remove the check accordingly.

Test: TH
Bug: 314858283
Fix: 316839561
Change-Id: I90c85ab98fbefd1f99ec799a4eec8d1d0cfd47b0

Junyu Lai   commited 2023-12-18 16:26:24 +08:00
8df4b700dd
[mdns] add service-side impl for subtypes advertising
This is the servide-side impl of the subtypes advertising added in
aosp/2608627. See that CL for more backgrounds.

Bug: 265095929
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I3d6f96822ac89d12fe29c00f688d848297c25787

Kangping Dong   commited 2023-12-18 10:03:20 +08:00
5af24b65fe
Merge changes from topic "ipsec-tramsform-state" into main
* changes:
  Expose APIs to query the state of an IpSecTransform
  Reland "Support getting transform state in IpSecService"

Yan Yan   authored and   Gerrit Code Review   commited 2023-12-13 18:26:25 +00:00
07e425cd0b
Merge "Don't add LOCAL_NETWORK as forbidden capability" into main
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2023-12-13 05:35:32 +00:00
9efc429906
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

Lorenzo Colitti   authored and   Remi NGUYEN VAN   commited 2023-12-13 11:24:25 +09:00
22941b38f7
Reland "Support getting transform state in IpSecService"
This reverts commit 69eb8325c0.

Bug: 308011229
Change-Id: I4dd68bdedc0088860895a833f2b4cb8e1845429a
Test: IpSecServiceParameterizedTest (new tests)

Yan Yan   authored and   Gerrit Code Review   commited 2023-12-12 22:19:55 +00:00
84fc0ee2d6
Merge "Revert "Support getting transform state in IpSecService"" into main
Yan Yan   authored and   Gerrit Code Review   commited 2023-12-12 22:05:19 +00:00
bf96d94820