Commit graph android_packages_modules_Co.../tests/integration
Message SHA1
Remove RecorderCallback.
This class doesn't actually serve a purpose, it only makes
TestableNetworkCallbck more complex.

Test: CtsNetTestCases ConnectivityCoverageTests
Flag: EXEMPT test-only
Change-Id: I39a598b82a3215384bdfe04980f4b280ab2c2716

Chalard Jean   commited 2025-05-19 16:35:53 +09:00
f2994122c1
Add a test to ensure link-local prefix does not trigger PD
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I77993cf154d4a3351294574735a238bd9db2da71

Patrick Rohr   commited 2025-05-15 18:45:36 -07:00
82d5add0c2
add an integration test to verify DHCPv6 PD rebind for P flag.
Flag: EXEMPT test-only change
Bug: 315069348
Test: atest FrameworksNetIntegrationTests
Change-Id: Ie1413c6aef964b40eff05cc77c45d1324ad1ad6f

Xiao Ma   commited 2025-05-12 18:30:52 +09:00
fddcd51793
Increase TIMEOUT_MS to 20s
Accounting for RS delay, a 2s timeout is not enough.

Test: TH
Flag: EXEMPT mainline
Bug: 416710891
Change-Id: I19e78f39c8d77e150792a36fe9c86791aac0c2f8

Patrick Rohr   commited 2025-05-11 16:32:04 -07:00
944bc19fbf
Add a test for a multihoming configuration
Without rule 5.5 this won't work correctly anyway. However, this tests
the behavior of the DHCPv6-PD client.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ibd84883391926f4e19c0e3d370d28fbcb68c0b8e

Patrick Rohr   commited 2025-05-06 12:22:54 -07:00
c2bae6716c
Add a test for multiple prefixes with p flags
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Iffa24fdfbf739b8135f94d6d3434a496de7f3f28

Patrick Rohr   commited 2025-05-06 08:17:23 -07:00
3a019692f0
Test that DHCPv6 provisioning succeeds
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I88421058cd4bf0b982ccb6ae5362e4f037130114

Patrick Rohr   commited 2025-05-05 14:51:43 -07:00
3db76bdfbc
Add end-to-end test for DHCPv6-PD
This adds the basic structure for a full end-to-end test for DHCPv6-PD
using a tap interface. This tests the interaction between the DHCPv6-PD
client, IpClient, and Netlink callbacks, and the kernel.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I6e56703187310ceaf6462b41f2e1ab3690faff01

Patrick Rohr   commited 2025-05-05 11:10:06 -07:00
7f6b868224
File the per-app request for opted-in satellite-optimized apps
Test: ConnectivityCoverageTest
Bug: 410731080
Flag: EXEMPT controlled in counter-part change ag/33220291
Change-Id: I0307f697a441c2810cafd4643d381e66a0ac9243

Chalard Jean   commited 2025-04-27 02:12:44 +09:00
76a60c1654
Add test to ensure clat drops multicast
Test: TH
Flag: EXEMPT mainline
Bug: 406956456
Change-Id: If47f7787b0826259157eb328ddf35c8c91b46fc6

Patrick Rohr   commited 2025-04-22 13:03:33 -07:00
0721786efe
Wait for the clat interface to be created
Clat interface creation is not always part of the second
LinkPropertiesChanged callback. This change processes
LinkPropertiesChanged callbacks until the clat interface has been
created, or no more LinkPropertiesChanged callbacks are received.

Test: atest ClatTest
Flag: EXEMPT mainline
Bug: 410685868
Change-Id: I8ff2dd95efef8dab9dfde99a1617895317c728d5

Patrick Rohr   commited 2025-04-15 09:40:25 -07:00
97ae103e4e
Align UdpPkt with scapy
Renames srcPort to sport and dstPort to dport and generates a random
port number in the range of [1, 65536) if no argument is passed.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: If446cde9a7ff414f52c60f70458ff046a2c4dc33

Patrick Rohr   commited 2025-04-14 15:47:41 -07:00
ea520794cc
Add (very) basic Clat Test
This test brings up a tap interface and starts clat on it by responding
with an RA including a PREF64 option.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Idf8e58d56a322185c97495585ecddf2432f1c820

Patrick Rohr   commited 2025-04-11 15:59:37 -07:00
59f53ac46f
Creating interface name to index tracking for Bpf Maps.
Adding mechanism to track interaface name to interface index, this map
would be used by BpfNetMaps for storing interface index.

Bug: 400681214
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.InterfaceTrackerTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Change-Id: I2a65cac908d9c4d10714e3fe26be20322d4a1db3

Sarup Dalwani   commited 2025-03-13 17:04:54 +00:00
53ecd95072
Check local network permissions when permission changes, or when user or
packages is added or removed

Bug: 388803658
Test: atest ConnectivityCoverageTests

Change-Id: I7d098c4d9a7614d0bd40ae23869a2010ee3f0779

Jacque Li   authored and   Neha Raj   commited 2025-02-20 04:59:45 +00:00
8d5c6eae80
Start L2capNetworkProvider in CS
Starts L2capNetworkProvider in ConnectivityService. Alternatively, this
could be moved to ConnectivityServiceInitializer instead in a follow up.

When L2capNetworkProvider is created, it starts a handler thread, so
makeL2capNetworkProvider must return null in tests as otherwise the
thread leaks.

Test: atest NetworkReservationTest
Change-Id: I35c14815b1a71f0739c1bf63ad466763d611434c

Patrick Rohr   commited 2025-02-18 19:19:22 -08:00
611ce3f57c
Listen to permission changes in permission monitor
Bug: 369646309
Test: atest
ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.PermissionMonitorTest

Change-Id: I23c524baaee6b9b06a855fb811906e5189ef03fd

Jacque Li   commited 2025-02-07 15:08:09 -05:00
2003e6ee49
Make java_sdk_library dependencies explicit
modules should specify the submodule of java_sdk_library that the module
actually depends on

Test: CI
Bug: 358613520
Change-Id: I0367068c901df98483f6cf95160d3e7801881b0a

Jihoon Kang   commited 2024-09-10 00:01:31 +00:00
8401b6a9f0
Revert^2 "Add blocked reason for internet permission"
This reverts commit cb74c08979.

Reason for revert: This change is not a cause of b/342557183

Change-Id: Iee8d9b05bbe130a46b627b12da525177b4ee89b2

Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-05-27 02:12:43 +00:00
cfd5a517da
Revert "Add blocked reason for internet permission"
This reverts commit ee96ba0e60.

Reason for revert: Droidmonitor triggered revert due to b/342557183. Will be verifying through ABTD before submission.

Change-Id: I7e185c3ac11da27c7bb9d95e4221f7dfc22cf48c

Priyanka Advani   authored and   Gerrit Code Review   commited 2024-05-24 18:11:45 +00:00
cb74c08979
Add blocked reason for internet permission
Currently, even if apps don't have INTERNET permission and can not use
network, network access is considered not blocked and
ConnectivityService send onBlockedStatusChanged callback with
blocked=false.
This CL introduced BLOCKED_REASON_NETWORK_RESTRICTED and consider
network access from apps targetting W+ on V+ releases is blocked if apps
don't have INTERNET permission.
Permission is set when the user is added or package is installed and
permission is removed when the user is removed or packages is
uninstalled.
So ConnectivityService does not need to monitor permission change to
send onBlockedStatusChanged callback by permission change.

Test: CSBlockedReasonsTest
Bug: 339559837

Change-Id: I58d2a4eddc714e205f5b96219f95b637f2826c58

Motomu Utsumi   commited 2024-05-24 13:45:51 +09:00
ee96ba0e60
Clear TrafficStats cache before getting readings from TrafficStats
Currently, TrafficStats have rate-limit on all get* APIs.
It is possible that result of uid traffic is updated but result
of iface is not. Thus, clear cache before read.

Test: atest CtsNetTestCases:android.net.cts.IpSecManagerTest#testIkeOverUdpEncapSocket --rerun-until-failure 100
Test: atest FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Bug: N/A
Change-Id: I1b7574d3062837fdded79cb945b582f2afad859b

Junyu Lai   commited 2024-04-02 15:21:20 +08:00
6c277682d5
Merge "[coverage] add integration tests for ServiceManagerWrapper" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-04-01 12:20:06 +00:00
aef1e27c1f
[coverage] add integration tests for ServiceManagerWrapper
add tests for ServiceManagerWrapper.java to coverage native NDK APIs
used in this module.

Bug: 330417869
Change-Id: Ibeb277fe1fea361b4e0fca58f3291d7fa925ab7f

Kangping Dong   commited 2024-04-01 16:11:39 +08:00
c465f64431
Merge "Fix lint errors" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-03-28 09:36:13 +00:00
7a9f5e9502
Fix lint errors
Format correction by ktlint.py --format

Test: TH
Bug: N/A
Change-Id: I886bdc9dee9c9e86bfdce1602343340010015212

Junyu Lai   commited 2024-03-28 17:06:51 +08:00
a96b97d24a
Merge "Use connectivityHandler in CarrierPrivilegeAuthenticator" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-03-21 07:22:41 +00:00
98eb360c0d
Use connectivityHandler in CarrierPrivilegeAuthenticator
When request_restricted_wifi is enabled CarrierPrivilegeAuthenticator
calls CarrierPrivilegesLost callback passed from ConnectivityService.
But CarrierPrivilegeAuthenticator was using its own handler thread to
receive broadcast and callbacks so CarrierPrivilegesLost callback needed
to post a message to the CS handler.
This CL updates CarrierPrivilegeAuthenticator to use CS handler if
request_restricted_wifi is enabled, and remove the message post in
ConnectivityService.

Test: TH
Change-Id: Ib41304a30e3dd366b0f6f1d7df81145f0e05ece1

Motomu Utsumi   commited 2024-03-18 22:16:53 +09:00
4fcaa4e803
Merge "Quit NetworkMonitor threads in integration tests" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-15 09:17:11 +00:00
2fae00cb39
Quit NetworkMonitor threads in integration tests
Similarly to NetworkMonitorTest, terminate NetworkMonitor threads and
ExecutorServices after each test case in integration tests.

This should fix flakes where the HTTP probe from testValidation could
finish after mock probe responses are cleared in tearDown.

The utils used in NetworkMonitorTest are factored out to ConcurrentUtils
to achieve that.

Fixes: 292481238
Test: atest --rerun-until-failure 50
Change-Id: I5cdeee8d4f06ea40e338dd2cb1fdcc2fe0907a7d

Remi NGUYEN VAN   commited 2024-03-14 13:18:44 +09:00
b3fcdacfae
Add CompatChange for local network matching
Apps that target an SDK before V will not see networks with
NET_CAPABILITY_LOCAL_NETWORK unless they explicitly set this capability
in their network requests.

Bug: 319212206
Test: CSLocalAgentTests
Change-Id: I414b03dfea9a8aac83304c6be501f03d637739b4

Motomu Utsumi   commited 2024-03-04 17:50:27 +09:00
ad480e0c58
Move NetworkStatsIntegrationTest from NetworkStack to Connectivity
Change package from android.net to com.android.server.net.integration,
and fix imported package dependency.

Bug: 322113686
Test: atest FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Change-Id: Id3c497f3b828d2cf85653d40253502565a1e8568

Jimi Chen   commited 2024-02-27 04:47:29 +00:00
bc8645aa8e
Store the SubscriptionId together with the Carrier UID
Always store the corresponding SubscriptionId together with the Carrier
uid so that when the carrier loses the Privilege, both the uid and
SubscriptionID will be used in the onCarrierPrivilegesLost callback

Bug: 324357121
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.CarrierPrivilegeAuthenticatorTest
      atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Change-Id: I28e51c583261a67d4441c6f825ade6781b862ee4

Ying Xu   commited 2024-02-20 08:58:31 -08:00
0d06b9460a
Support Satellite Network Preferred uid's multi layer request
- Implement handleSetSatelliteNetworkPreference() at ConnectivityService
  to create multi layer request with preference order
  PREFERENCE_ORDER_SATELLITE_FALLBACK.
- unit test coverage

Bug: 320514105
Test: m and atest FrameworksNetTests
Change-Id: I3f71104f8c3c998599eaab71ae4076985f4bed77

Nagendra Prasad Nagarle Basavaraju   commited 2024-02-07 16:16:42 +00:00
804aa2326d
Support bringing up restricted wifi
This CL allows the Carrier Config app to request restricted WiFi nework
by setting the correspoding subscription ID in the network request.

Bug: 315835605
Test: atest android.net.cts.NetworkRequestTest
      atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.CarrierPrivilegeAuthenticatorTest
      atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest

Change-Id: I237e692d092ff5f969ce4b7962f6d58099a6f3a9

Ying Xu   commited 2024-02-07 04:24:38 -08:00
7cabd32bc5
[DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5

Aditya Choudhary   commited 2024-01-31 12:34:50 +00:00
01b5ede2b2
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
Relax testValidation pass condition
The issue arises when the network becomes validated based on the
isCaptivePortal success with HTTPS, even though the HTTP probe
hasn't been executed yet. Given that there is no way to ensure
HTTP probe was sent in this case, the pass condition should be
relaxed, allowing a single https query instead of expecting both.

Test: atest FrameworksNetIntegrationTests:ConnectivityServiceIntegrationTest#testValidation \
      --rerun-until-failure 100
      (With hardcoded sleep when starting HTTP probe)
Fix: 303351630
Change-Id: I580e9a3a868cd0b3395a20ace27b006529475312

Junyu Lai   commited 2023-11-23 07:23:08 +00:00
9273ae0fd0
Add test for cgroup bpf program status
This is useful to ensure cgroup bpf program is attached,
which would lead to hard-debugging uid stats missing problem.

Test: atest ConnectivityServiceIntegrationTest#testBpfProgramAttachStatus
Bug: 292156770
Change-Id: I16370497484aff29ed41cbb0d160e530731e1a4e

Junyu Lai   commited 2023-10-23 13:38:04 +08:00
54e84ab05a
Add PACKAGE_USAGE_STATS permission to ConnectivityServiceIntegrationTest
Bug: 303299687
Test: atest
Change-Id: Iad740804a59599dd33add1ea85aa4771e0e4bd35

Motomu Utsumi   commited 2023-10-05 12:23:20 +09:00
aa2f4d839e
wear proxy behind portal
Do not avoid captive portal on wear proxy network; keep network agent
after detecting portal.

Bug: 291112432
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Change-Id: I8f6669da62ebd76b6a46d2aec9b3ea563a08cb5e

Andriy Naborskyy   commited 2023-09-27 07:28:05 +00:00
d032dd42ea
Add base classes for common ConnectivityService tests.
This sets up what is necessary for an instrumented
ConnectivityService to run. Users of this class are
meant to inherit CSTest.

This is still relatively basic and does not have all the
instrumentation in ConnectivityServiceTest. Developers
looking to extend CSTest may find some instrumentation
missingĀ ; when they add the missing instrumentation,
they should consider whether it should be generic for all
CSTests (and put it in base/), or whether it's local to
their own test suite. This should enable faster testing
as each CSTest children will only need to set up the
instrumentation it actually needs.

This patch also migrates a basic test to have a first user.

Bug: 272685721
Test: ConnectivityServiceTest
      CSBasicMethodsTest
Change-Id: I1c47f616af90629c9cb2a6ae89d992b19863e704

Chalard Jean   commited 2023-09-11 16:46:27 +09:00
0f5c4fe9cb
Fix kotlin nullable errors in Connectivity tests
Fix kotlin nullable errors that were exposed by setting the retention
of android.annotation.NonNull and android.annotation.Nullable to
class retention.

Bug: 294110802
Test: builds
Change-Id: Id49e4a2ee0b7b463d99bce6eb22919b84c21443a

Colin Cross   commited 2023-08-09 10:57:35 -07:00
4e5a061f26
Set test component in common OWNERS
Move the test component configuration from subdirectories
to the common OWNERS file. This ensures that all test directories
like unit/ that did not have the component set are covered.

Bug: 288137916
Change-Id: I48fbe846309cace41588c5ff3dfd46e878c38576
Test: TH

Remi NGUYEN VAN   commited 2023-06-21 02:54:13 +00:00
64020abf11
Move ConnectivityResources to service-connectivity
The ConnectivityResources class is only usable with QUERY_ALL_PACKAGES
permission, so it is not generally usable in framework-connectivity. It
is also backed by the ServiceConnectivityResources APK, which is
intended as resources for service-connectivity.

Move the class to service-connectivity and update callers. CTS needs a
way to determine the supported keepalive count as it used the
resources from KeepaliveUtils as @hide API, so provide a
ConnectivityManager @hide API for testing.

Bug: 279108992
Test: atest
Change-Id: I3c9a77c580b5ab87c922c32778bce15dc33b4d1d

Remi NGUYEN VAN   authored and   Motomu Utsumi   commited 2023-04-28 19:18:39 +09:00
bee2ee14f3
Use current shims in service-connectivity
Instead of NetworkStackApiStableShims, use NetworkStackApiCurrentShims
as this is a development branch.

Use java_defaults in the "merge conflicts expected" section, so that
module release branches can use the same defaults, but set it to
NetworkStackApiStableShims.

The shims are removed from FrameworksNetIntegrationTests, as they are
already available there through service-connectivity-pre-jarjar. Keeping
them as a dependency would make FrameworksNetIntegrationTests use both
Stable shims (directly) and Current shims
(through service-connectivity-pre-jarjar).

Bug: 266205506
Test: m
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:921290b49d109360aae5dc39effaa3b0e691f65a)
Merged-In: I88228152834a1c06830fb51e868fb8e3d8c47519

Change-Id: I88228152834a1c06830fb51e868fb8e3d8c47519

Remi NGUYEN VAN   authored and   Motomu Utsumi   commited 2023-03-27 15:56:23 +09:00
02eee9aa5a
Remove expectLinkPropertiesThat
expect() is simply better

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: I5bf109ccf34f1fa5ce2f4ed78300d5a126778e30

Chalard Jean   commited 2023-02-10 14:32:14 +09:00
816f0af86a
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

Chalard Jean   commited 2023-02-07 18:17:33 +09:00
99cab4a44c
Add a device config for actively preferring bad wifi
Test: FrameworksNetTests
      adb shell device_config put connectivity actively_prefer_bad_wifi
       + check that dumpsys updates
Test: at this patchset tests fail with :
      Permission denial: reading from settings requires:android.permission.READ_DEVICE_CONFIG

Change-Id: Icfe1e64b8313921ff1dc8e4cbd45f967692e1c4a

Chalard Jean   commited 2022-10-03 11:53:58 +09:00
e0fdea3c5e