Commit graph android_packages_modules_Co.../tests/unit/java
Message SHA1
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
[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
Revert "Support getting transform state in IpSecService"
This reverts commit ab5006c17d.

Reason for revert: b/316010034 breaking VCN unit tests

Change-Id: I68cb1a99bb6e492c16901972d201761cd00df6fa

Yan Yan   authored and   Gerrit Code Review   commited 2023-12-12 21:53:46 +00:00
69eb8325c0
Merge "Support getting transform state in IpSecService" into main
Yan Yan   authored and   Gerrit Code Review   commited 2023-12-12 18:23:47 +00:00
abf9dcebdd
Add more timeout for verify the interaction of the mock object
The verification happened earlier than the interaction with
production code. This may happen in low performance devices,
e.g. cuttlefish. Add timeout for the verification to deflake
the test.

Bug: 313828402
Test: atest FrameworksNetTests
Change-Id: I1ffa7e7573d503eb0396aa211a90ba032175b3a1

Chiachang Wang   commited 2023-12-12 06:44:29 +00:00
d0535553c6
Support getting transform state in IpSecService
Bug: 308011229
Test: IpSecServiceParameterizedTest (new tests)
Change-Id: I3f1c2ef60ee9b6ac17909e0ee083ee6f8483588e

Yan Yan   commited 2023-12-12 00:14:13 +00:00
ab5006c17d
Merge "[XFRM_MSG_NEWSA] Support polling SA state with netlink message" into main
Yan Yan   authored and   Gerrit Code Review   commited 2023-12-11 23:27:17 +00:00
96db51b377
[XFRM_MSG_NEWSA] Support polling SA state with netlink message
Bug: 308011229
Test: IpSecXfrmControllerTest
Change-Id: Id765cd8d8d7e330969877cb0890bd828417fb6b8

Yan Yan   commited 2023-12-11 18:43:34 +00:00
4df361975d
Merge "[BR14] Tracker Data Saver status in ConnectivityService" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-12-11 10:09:57 +00:00
5ad399d8c3
[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

Junyu Lai   commited 2023-12-08 13:54:29 +08:00
38c7503ab5
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

Paul Hu   commited 2023-12-07 08:38:48 +00:00
516e27f9c3
Merge "Add support for setsockoptBytes" into main
Yang Sun   authored and   Gerrit Code Review   commited 2023-12-05 07:35:02 +00:00
38795d6f89
Merge "Remove unused Vpn Dependency methods in VpnTest." into main
Hansen Kurli   authored and   Gerrit Code Review   commited 2023-12-04 05:23:06 +00:00
997bb6c79e
Add support for setsockoptBytes
Test: atest FrameworksNetTests:android.net.connectivity.android.net.NetworkUtilsTest
Change-Id: I3d94172fa8a42e2ab8ba4caf80d5caaa11fac703

Yang Sun   commited 2023-12-04 09:02:45 +08:00
f2987b8bf8