Commit Graph

91144 Commits

Author SHA1 Message Date
Kangping Dong
7dffade561 [Thread] add a script for make-pretty
This make-pretty.sh can be called from any where and it formats only
java code under packages/modules/Connectivity/thread/

Test: ./thread/scripts/make-pretty.sh
Change-Id: I1b24025cf0267c81a7b133d1e8a08f77cc7ddc0e
2023-11-07 12:41:42 +08:00
KH Shi
cbee43da40 [Refactor] move BPF tests to BpfCoordinatorTest
Preparing for refactor of IpServer and BpfCoordinator. All BPF related
code are planned to migrate from IpServer to BpfCoordinator. This CL
moves BPF related tests from IpServerTest to BpfCoordinatorTest first.

Test: atest TetheringTests
Bug: 294025403
Change-Id: I000f27c463368202dbbe2ace188c8c5146669096
2023-11-07 04:32:57 +00:00
Mark Chien
9f76411b63 Merge "Extend tethering enable/disable timeout to 30 seconds" into main 2023-11-07 03:52:26 +00:00
Treehugger Robot
6795186c00 Merge "Remove the OffloadServiceInfo from jarjar exclusion" into main 2023-11-07 03:27:41 +00:00
Motomu Utsumi
ada9e9877c Make FlaggedAPI available to CtsThreadNetworkTestCases
FlaggedAPI will be ignored in udc-mainline-prod.
This makes CtsThreadNetworkTestCases build fail.
This CL updates CtsThreadNetworkTestCases to build against FlaggedAPI
and also updates framework-connectivity-jarjar-rules not to jarjar
FlaggedAPI.

Test: TH
Test: m CtsThreadNetworkTestCases
Change-Id: Ida8872b3bf61b7a59733f5fcec9e7d250efd3e58
2023-11-07 12:21:45 +09:00
Jean Chalard
85fce4f871 Merge "Set up forwarding rules for local network agents" into main 2023-11-07 02:50:50 +00:00
Treehugger Robot
76a287cdec Merge "Assign default bug component to targets in this directory." into main 2023-11-06 13:30:09 +00:00
Chalard Jean
1e4c218c28 Set up forwarding rules for local network agents
Test: CSLocalAgentTests, new tests for this
Change-Id: I8994af350a1799ab5f6ebb2872f2abfaf174bd61
2023-11-06 20:18:50 +09:00
Motomu Utsumi
d872c3c960 Merge "Add methods for updating ingressDiscardRule bpf map to BpfNetMaps" into main 2023-11-06 10:41:53 +00:00
Chiachang Wang
a8efe40865 Remove @IgnoreUpTo(Q) annotation and isAtLeastR() check
Remove the Q test annotation/check since mainline updates does
not push to Q anymore. This annotation is unnecessary now.

Test: atest FrameworksNetTests
Change-Id: Iba4f38731db9f369f99ba12a3ab7ef3f3b1630b8
2023-11-06 09:35:28 +00:00
Junyu Lai
092839a6b5 Merge changes from topic "apipluscts" into main
* changes:
  [BR03.3] Add feature version constant for accessing bpf in Connectivity
  [BR03.1] Expose isUidNetworkingBlocked
2023-11-06 09:09:03 +00:00
Yuyang Huang
56cb85e1f5 Remove the OffloadServiceInfo from jarjar exclusion
The OffloadServiceInfo is already became API. It is not necessary to
keep it in jarjar exclusion anymore.

Test: TH
Change-Id: I81020553dfab4d7d8c88a67959058a99beb3b803
2023-11-06 17:49:53 +09:00
Junyu Lai
ec5500de79 [BR03.3] Add feature version constant for accessing bpf in Connectivity
This is needed by the callers to determine if the Tethering
module is new enough to support the API that get whether
the network is blocked for the given uid and conditions.

Test: adb shell cmd network_stack is-uid-networking-blocked <uid> <metered>
Bug: 297836825
Change-Id: Ie79eacb1e63ff60291ad4f0ef6e8bba5ab0bdb07
2023-11-06 14:51:01 +08:00
Junyu Lai
bb59480733 [BR03.1] Expose isUidNetworkingBlocked
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 297836825
Change-Id: I70b2351b9cd1c3c6fa34258397e0bf22cb8150b2
2023-11-06 13:26:19 +08:00
Chiachang Wang
95cf7f9550 Merge "Rename method connectSocketToNetlink to connectToKernel" into main 2023-11-06 05:25:46 +00:00
Maciej Żenczykowski
bf1f867ce6 Merge "[Test] Fix DNS resolver MTS failures" into main 2023-11-06 03:41:02 +00:00
Chiachang Wang
fe84f59ff0 Rename method connectSocketToNetlink to connectToKernel
Address leftover comments in aosp/2354202.

Bug: 265877161
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I77f36b890265e9af6f5ab866d5e0071363bb3d0f
2023-11-06 03:18:18 +00:00
Maciej Żenczykowski
20a870f945 Merge "Update fmtlib to 10.1.1" into main 2023-11-05 05:21:40 +00:00
Ken Chen
90e009be6c [Test] Fix DNS resolver MTS failures
In MTS, test infra installs only the DNS resolver module without
installing tethering module. The test utils should not assume the BPF
maps defined in tethering will be in the device.

Bug: 309164580
Test: atest
resolv_integration_test:ResolverTest#BlockDnsQueryWithUidRule

Change-Id: I2c7349a11c9b413c129c93d236c8280588097cf7
2023-11-04 16:10:34 +08:00
Henri Chataing
6cc0283095 Update fmtlib to 10.1.1
Test: m
Change-Id: I15107355d2c26f69be5bb336e978eac55f65c437
2023-11-03 23:26:47 +00:00
Dario Freni
5e157ce460 Assign default bug component to targets in this directory.
This CL is being created to improve the test attribution in android. It has been 
found that the tests owned by this OWNERS are not not being attributed to a
buganiser component.
This is part of a bigger effort to attribute all of the aosp code. 

If you think that the buganiser component is not correct please update
this CL with correct component and drop a +2.
We will use the updated component and merge the CL

Bug: 309090038
Change-Id: Ie6839c3f6d07a554c60d544acea712d8de76b6b2
Test: N/A
2023-11-03 13:10:17 +00:00
Jean Chalard
1d6c358a9d Merge "Add forwarding methods to RoutingCoordinator" into main 2023-11-03 04:39:48 +00:00
Ryan Zuklie
ac871ada08 Merge "Report sparse per-iface stats using atrace." into main 2023-11-02 20:40:00 +00:00
Ryan Zuklie
f5fc2e3403 Report sparse per-iface stats using atrace.
This reports the total bytes sent and received per interface using
atrace. The totals are taken from the interface counters, rather than
the ringbuffer, since the ring buffer can run out of space.

Interfaces are only reported for interfaces which have packets
sent on them as identified by Nettrace. This helps reduce the cost
significantly for idle periods and on devices with a large number of
interfaces accumulated in the iface stats maps.

Test: TreeHugger
Change-Id: I0e6a3b11de0d1e153b9f8ebb97c338f425381a9c
2023-11-02 10:24:05 -07:00
Chalard Jean
820ce9df2d Add forwarding methods to RoutingCoordinator
Test: RoutingCoordinatorServiceTest
      TetheringTest
Change-Id: I2fa6250875d517c3452c85a3678d3feb0c0354d8
2023-11-02 23:25:32 +09:00
Chalard Jean
842a914dff Rename KEEP_CONNECTED_DOWNSTREAM_NETWORK to K_C_LOCAL_NETWORK
...following feedback

Test: FrameworksNetTests
Change-Id: I9c25f0b066a58980bf071d2b958223ed609f0d8e
2023-11-02 23:25:31 +09:00
Chalard Jean
78c9a381c9 Enforce structural NetworkAgent constraints
Avoid network agents trying to do things that the stack
does not support.

Test: new test in this change
Change-Id: I3ffa1c3ddbb0b648b06862dc0a44f8525d358acc
2023-11-02 23:25:11 +09:00
Jean Chalard
4fd9451cdb Merge "Run CSDestroyedNetworkTests starting in R" into main 2023-11-02 10:23:50 +00:00
Motomu Utsumi
2a2e2c34b0 Merge "Update udc-extended-api that ignores FlaggedAPI annotation" into main 2023-11-02 09:23:37 +00:00
Junyu Lai
31ab762e42 Merge "[BR06] Support check whether network is blocked by data saver" into main 2023-11-02 07:09:50 +00:00
Chalard Jean
0a0be176d2 Run CSDestroyedNetworkTests starting in R
This can only run where the connectivity module is updated

Bug: 308601625
Test: TH
Change-Id: Icc5df3013e90070502a805abe89725591470b464
2023-11-02 14:00:16 +09:00
Motomu Utsumi
ef98bd5ff8 Update udc-extended-api that ignores FlaggedAPI annotation
Test: m checkapi in udc-mainlnine branch
Change-Id: I9baa1b1537b4ceb1ac9696da2026fffd71c58067
2023-11-02 04:26:37 +00:00
Ken Chen
90428539d6 Merge "Add Data Saver utils in Firewall test helper class" into main 2023-11-02 02:35:44 +00:00
Junyu Lai
2deeef4f5e Merge "Fix NetworkStatsObersers thread leak in the NetworkStatsServiceTest" into main 2023-11-01 10:18:50 +00:00
Junyu Lai
8b5ebfc342 Fix NetworkStatsObersers thread leak in the NetworkStatsServiceTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
     (with debug code that dump all threads at the end of tests)
Fix: 308544001
Change-Id: I597054633bbb008ffd0edebe34dcf6935958aa5d
2023-11-01 17:11:17 +08:00
Hansen Kurli
8f329c2e97 Merge changes I5fffc137,Ifc076a8d into main
* changes:
  Add Log.wtf when keepalive metrics are unexpected.
  Add dump of KeepaliveStatsTracker
2023-11-01 08:50:39 +00:00
Hansen Kurli
a746c1a4da Add Log.wtf when keepalive metrics are unexpected.
To debug unexpected keepalive metrics values, print the built
metrics in a Log.wtf before writing it to statsd.

Bug: 297292877
Test: atest FrameworksNetTests
Change-Id: I5fffc13721e50e28f24b0da12a961364f3f77e21
2023-11-01 14:41:35 +08:00
Hansen Kurli
723c273be3 Add dump of KeepaliveStatsTracker
To debug unexpected metrics values, print the built metrics into
the connectivity dump.

Sample of the added log dump:
KeepaliveStatsTracker enabled: true
   # android.net.connectivity.com.android.metrics.Dailykeepalive
InfoReported@3293424e
   automatic_keepalive_requests: 2
   distinct_user_count: 1
   duration_per_num_of_keepalive {
     duration_for_num_of_keepalive {
       keepalive_active_durations_msec: 36
       keepalive_registered_durations_msec: 36
       num_of_keepalive: 0
     }
     duration_for_num_of_keepalive {
       keepalive_active_durations_msec: 9
       keepalive_registered_durations_msec: 6
       num_of_keepalive: 1
     }
     duration_for_num_of_keepalive {
       keepalive_active_durations_msec: 7
       keepalive_registered_durations_msec: 10
       num_of_keepalive: 2
     }
   }
   keepalive_lifetime_per_carrier {
     keepalive_lifetime_for_carrier {
       active_lifetime_msec: 23
       carrier_id: -1
       intervals_msec: 10000
       lifetime_msec: 26
       transport_types: 1
     }
   }
   keepalive_requests: 2
   uid: 10097

Bug: 297292877
Test: adb shell dumpsys connectivity
Test: New test testDumpDoesNotCrash()
Change-Id: Ifc076a8dce734e9c175f1b1f28e1c448b9a792e5
2023-11-01 14:41:24 +08:00
Chiachang Wang
006f9d2998 Merge "Quit handler threads at the end of the tests" into main 2023-11-01 06:29:33 +00:00
Paul Hu
a6307ea9f1 Merge "Remove DefaultState in NsdService" into main 2023-11-01 03:40:37 +00:00
Junyu Lai
2c8e96d599 Merge "[BR02] Implement isUidNetworkingBlocked" into main 2023-11-01 03:40:05 +00:00
Ken Chen
832591ff3c Merge "Support Data Saver awareness in libcom.android.tethering.dns_helper.so" into main 2023-11-01 03:29:36 +00:00
Ken Chen
ee734fd41e Merge "Add dns_helper_unit_test in TEST_MAPPING" into main 2023-11-01 03:28:07 +00:00
Ken Chen
2c651494fa Merge changes from topic "native_isUidNetworkingBlocked" into main
* changes:
  [Test] for libcom.android.tethering.dns_helper.so
  Add a library for DNS resolver to read bpf maps
2023-11-01 03:25:27 +00:00
Junyu Lai
c3dc5b6222 [BR06] Support check whether network is blocked by data saver
This change adds a DataSaverStatusTracker, which is a helper
class to continuously track data saver status through NPMS
public API and intents. ConnectivityManager#isUidNetworkingBlocked
would use this cached information along with bpf maps to decide
whether networking of an uid is blocked.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.ConnectivityManagerTest
Bug: 297836825
Change-Id: I7e13191759430f3ea1f4dec7facc02f16be7146d
2023-11-01 11:10:01 +08:00
Chiachang Wang
2973cf4363 Quit handler threads at the end of the tests
The created handler threads should be quit after the tests to
prevent memory leakage. Also, this commit updates the method
used to close the created HandlerThread to do it correctly.

Bug: 308537727
Test: atest ConnectivityCoverageTests
Change-Id: I3715a73a9142418c05f98bc95e275f97161ab3cd
2023-11-01 01:24:07 +00:00
Ken Chen
5b144a1061 Add Data Saver utils in Firewall test helper class
Resolv_integration_test needs the function to toggle Data Saver settings
in BPF map.

Bug: 288340533
Test: atest resolv_integration_test
Change-Id: I1725d3c8c6fc641b855c935d7289a99f78dd5933
2023-11-01 06:23:09 +08:00
Ken Chen
006a3f1514 Support Data Saver awareness in libcom.android.tethering.dns_helper.so
Make ADnsHelper_isUidNetworkingBlocked() to reference 'metered'
information and Data Saver related BPF maps to make the final decision.

Bug: 288340533
Test: atest dns_helper_unit_test
Change-Id: I51b1dadd56a8d6fda3f8b18d64740e52b76e1bfe
2023-11-01 06:23:09 +08:00
Ken Chen
d4e5c76c6e Add dns_helper_unit_test in TEST_MAPPING
Enable test in postsubmit.

According to go/test-mapping-slo-guide, the test needs to meet
postsubmit SLO before adding it to presubmit.

Bug: 288340533
Test: run presubmit
Change-Id: Id5fae55fa0cb7c7b15e183bbea66c7a139360d95
2023-11-01 06:23:09 +08:00
Ken Chen
d4876dec06 [Test] for libcom.android.tethering.dns_helper.so
Exercise the BpfReader::isUidNetworkingBlocked().

Bug: 288340533
Test: atest dns_helper_unit_test
Change-Id: Icc889a6a9649e991cba222427f9b8d4f5ee3b325
2023-11-01 06:23:09 +08:00