Commit graph android_packages_modules_Co.../tests
Message SHA1
Merge changes Ic490fee6,If78047c3 into main
* changes:
  Add hidden constants for communicating about local network agents
  Use isAtLeast* from deps

Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-12 11:01:36 +00:00
10353d5351
Merge "Stop the created handler threads on the tests" into main
Paul Hu   authored and   Gerrit Code Review   commited 2023-10-12 07:13:30 +00:00
0b5d785096
Add hidden constants for communicating about local network agents
Test: FrameworksNetTests
Change-Id: Ic490fee6ee70d74acff0a290199b2946817173d0

Chalard Jean   commited 2023-10-12 13:30:49 +09:00
d6f4efb1a8
Use isAtLeast* from deps
CSTest and CSAgentWrapper need to agree on what the current
version is

Test: CSTest*
Change-Id: If78047c36ce213a531207d25b410e870691fbb98

Chalard Jean   commited 2023-10-12 13:30:49 +09:00
5efbcf7bab
Stop the created handler threads on the tests
The created handler thread will stay there for a while until
all the tests are finished. This is considered as a leakage
which will take the resource from the devices. In low end
devices, this may possibly impact the performance. The created
threads should be closed explicitly.

Test: atest ConnectivityCoverageTests ConntrackSocketTest
Change-Id: Ic1beb2a210e7c8c80c66fc9e0727c47599150672

Paul Hu   commited 2023-10-12 10:25:03 +08:00
ebbbf8f470
Merge changes Ibb8d33b7,Ie168fe1f,I9f699b63 into main
* changes:
  Prepare exposing Network{Request,Caps}.forbiddenCapabilities
  Add a keep connected for test reason
  Improvements to CSTest : legacy type, wait for LOST, permissions

Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-12 02:14:52 +00:00
02193c0cce
Merge changes Ib24809ec,Id9d26435 into main
* changes:
  Remove the fail case on IPv6 in testLockdownVpn
  Remove LockdownVpnTracker from testLegacyLockdownVpn

Hansen Kurli   authored and   Gerrit Code Review   commited 2023-10-11 12:03:37 +00:00
270813c4c5
Prepare exposing Network{Request,Caps}.forbiddenCapabilities
This is useful going forward in particular because there will
be a default forbidden capability for LOCAL_NETWORKS. This
means it will be useful to be able to remove it.

It is also generally useful and we have been wanting to open
this API to the public, so this is a good opportunity to do so.

Test: new tests for NetworkRequest
      NetworkCapabilitiesTest already has tests because it
      already was @SystemApi
Change-Id: Ibb8d33b799f2d274326fd9cd0b05a2c33a18032a

Chalard Jean   commited 2023-10-11 17:02:52 +09:00
cf7dbcae41
Add a keep connected for test reason
This has been sorely needed for a while. Instead of filing requests
for each of your networks in a CSTest, which is fiddly at best and
sometimes almost impossible (because you can't single out the network),
you can now add this flag and be done with it.

Test: CSKeepConnectedTest
Change-Id: Ie168fe1f3a17de035fdf05e3d6580d3262a3448e

Chalard Jean   commited 2023-10-11 17:02:52 +09:00
c517fb1247
Improvements to CSTest : legacy type, wait for LOST, permissions
• Make sure all Agents have a legacy type. This is necessary to
  avoid crashes in LegacyNetworkTracker
• Wait for LOST when disconnecting a network
• Make sure the test package sees its own permissions (importantly
  it can't see background networks otherwise, because it lacks
  CHANGE_NETWORKING_STATE)

Test: in the followup
Change-Id: I9f699b6372a8fe0d5bcd5310d8f35f72e48a6c61

Chalard Jean   commited 2023-10-11 17:02:51 +09:00
026ca940d9
Reword a comment for accuracy
Test: none needed
Change-Id: I7e409827adc86fc13975f394100889a6bf0f1e50

Chalard Jean   commited 2023-10-10 20:12:40 +09:00
f70919fbec
Allow for mocking an SDK in the tests
Test: in followup patches
Change-Id: I540ce2a455c92be52eb94fbd4b54a2081d04d25e

Chalard Jean   commited 2023-10-10 14:57:22 +09:00
eb66389d6a
Merge "Expose the netd mock in CSTest to allow verifying calls on it" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-10 04:17:29 +00:00
4dec273ab4
Merge "Add missing copyright notices to tests" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-10 04:16:52 +00:00
e339c6b780
Merge "Clean up obsolete aliases for Truth." into main
Krzysztof Kosiński   authored and   Gerrit Code Review   commited 2023-10-09 23:08:57 +00:00
22d08770af
Merge "[mdns] exclude mDNS advertiser code from standalone build test" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2023-10-08 12:21:24 +00:00
4a8977c452
[mdns] exclude mDNS advertiser code from standalone build test
service-connectivity-mdns-standalone-build-test builds the mDNS
discovery and advertisement implementation against API level 21.
This stops the advertisement code from calling new NsdServiceInfo
public or private APIs which are required by Thread.

This commit removes the mDNS advertisement code from the standalone
build to loose the check given this will never be used by GMS Core.

Bug: 265095929
Test: verified that it can build with aosp/2608627
Change-Id: I32cfce7b994d51a4b4ec468e9f79ffc2be6635ff

Kangping Dong   commited 2023-10-08 17:22:14 +08:00
1a1beee654
Expose the netd mock in CSTest to allow verifying calls on it
Test: manual
Change-Id: Ib39dc4dbf534f14d94923bb0026f18e47edabba2

Chalard Jean   commited 2023-10-07 15:11:40 +09:00
ff7edd36eb
Add missing copyright notices to tests
Test: comment-only change
Change-Id: I63bada891757d7e991cc7538c56e4fc50074ee5d

Chalard Jean   commited 2023-10-07 15:09:21 +09:00
52afbf2634
Clean up obsolete aliases for Truth.
Bug: 255714762
Test: presubmit
Change-Id: If91e9af5409fed9d5ccdd13749a0f562c545d589

Krzysztof Kosiński   commited 2023-10-07 00:48:10 +00:00
739ed22507
move BPF_CGROUP_INET*_BIND registration into BpfHandler
(in preparation for moving it into netbpfload)

The programs themselves (in bpf_progs/block.c) required a 5.4+ kernel.

We relax this restriction to 4.19+ as we don't have any 5.4 device coverage
(while the pixel 4a 5G / 5 / 5a are all 4.19 devices).

I believe we could relax it further to 4.14+ but Pixel 4/4xl/4a that
would exercise those code paths are EOL and probably have poor to
non existent test coverage, and we cannot do anything for 4.9 T devices
anyway.

Note: on <4.19 kernels (ie. T devices running 4.9/4.14, U running 4.14)
this results in ConnectivityNativeService going from null to initialized
(as the bpf map will exist).

This doesn't hurt as the set/clear port interfaces are only ever
called by vendor code on devices where the kernel doesn't support
the older mechanism.  And even if you call them it will just set/clear
the bits in the bpf bitmap, they just won't actually affect anything.

We could flag the map itself as being 4.19+ as well, but I think
I prefer the no-op map to exist...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1085addd22f4f3b709e1875049633832c5dac836

Maciej Żenczykowski   commited 2023-10-06 14:31:20 -07:00
3cb494fd28
Merge "Store transaction id in MdnsPacket" into main
Paul Hu   authored and   Gerrit Code Review   commited 2023-10-06 05:51:33 +00:00
87d128f43d
Merge "Add PACKAGE_USAGE_STATS permission to ConnectivityServiceIntegrationTest" into main am: 6a5ab05e87
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2774205

Change-Id: I476aa7fc7f839285e7a86596b06a0e4a7dbee316
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2023-10-05 07:18:41 +00:00
b3493eea05
Merge "Add PACKAGE_USAGE_STATS permission to ConnectivityServiceIntegrationTest" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-10-05 06:44:32 +00:00
6a5ab05e87
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
Merge "Remove an NPE in tearDown" into main am: e7b7ceb70d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2770460

Change-Id: I017eafbc7dcf191cf6babcd3c43fa89a66546bbc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Jean Chalard   authored and   Automerger Merge Worker   commited 2023-10-05 03:07:15 +00:00
ddd00cd23a
Merge "Remove an NPE in tearDown" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-05 02:44:59 +00:00
e7b7ceb70d
Merge "cts: fix android.net.cts.VpnServiceTest#testProtect_int flake" into main am: 99c8a5d1e2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2768572

Change-Id: I84417bfd7fcc5f86b86edf2c2640d60a2af45126
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Maciej Żenczykowski   authored and   Automerger Merge Worker   commited 2023-10-04 13:47:50 +00:00
38cd577ed9
Merge "cts: fix android.net.cts.VpnServiceTest#testProtect_int flake" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-10-04 13:10:54 +00:00
99c8a5d1e2
Remove the fail case on IPv6 in testLockdownVpn
In testLegacyLockdownVpn, remove the fail check on IPv6 networks
and add coverage in VpnTest instead as this interaction relies
on the Vpn implementation, not ConnectivityService.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: Ib24809ece2332c4c3d3e08c168e02ad859242eac

Hansen Kurli   commited 2023-10-04 16:45:45 +08:00
acb5205558
Remove LockdownVpnTracker from testLegacyLockdownVpn
The test coverage of LockdownVpnTracker has been moved to a
separate unit test file. testLegacyLockdownVpn now calls the Vpn
methods directly instead of creating a new LockdownVpnTracker.
Note this removes calls to expectStopVpnRunnerPrivileged since
stopVpnRunnerPrivileged is now directly called in the test so it
is already guaranteed to be called.

The expected calls/behavior of LockdownVpnTracker can be seen in
LockdownVpnTrackerTest.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: Id9d26435bf62ffef954f6c7fa0558ce99540de1f

Hansen Kurli   commited 2023-10-04 16:44:09 +08:00
35f6fef389
Merge "Cleanup existing firewall rule on myUid before the test" into main am: 18520551db
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2762791

Change-Id: I02664c27248091212dbfc094b2a8364fbfc2e7b8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2023-10-04 02:44:40 +00:00
bbf74da2b5
Merge "Cleanup existing firewall rule on myUid before the test" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-10-04 02:15:06 +00:00
18520551db
cts: fix android.net.cts.VpnServiceTest#testProtect_int flake
This is written based on observation that
  testStartVpnProfileNoPreviousConsent()
appears to result in the right things happening when running
  adb logcat | egrep --color -i 'Switched from |protect'
ie. it results in:
  I netd    : networkSetProtectDeny(<ctsappuid>) <0.01ms>
  I Vpn     : Switched from android.net.cts to [Legacy VPN]
  I netd    : networkSetProtectAllow(1000) <0.00ms>

Which disallows the CTS uid, and allows AID_SYSTEM.

That in turn appears to be the 'default' state of things.

So this basically copies that logic into tearDown()

Test: atest android.net.cts.{Ikev2VpnTest,VpnServiceTest} --iterations 2
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic9cca56097d78ae48157e808081de2ebb76635e8

Maciej Żenczykowski   commited 2023-10-03 23:59:20 +00:00
ee20a09bdb
Merge "Disable the remaining VPN CTS tests on watches." into main am: c8a42f6a39
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2624254

Change-Id: I5999183d5d641ada0e1b477c2edcb73ee2c45d2f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2023-10-03 17:46:04 +00:00
1032b1c039
Merge "Disable the remaining VPN CTS tests on watches." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-10-03 16:39:31 +00:00
c8a42f6a39
Merge "Prioritize non-slices over slices" into main am: d393732dba
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2760328

Change-Id: Iba848062cefe19639fd104f03cd03d0dfddb634a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Jean Chalard   authored and   Automerger Merge Worker   commited 2023-10-03 13:13:33 +00:00
98f2f90a82
Merge "Prioritize non-slices over slices" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-03 12:39:11 +00:00
d393732dba
Prioritize non-slices over slices
For general internet access, a specialized slice is generally
not preferable to a non-specialized network.

Test: new test in this patch
Change-Id: I052ce923300566807999b2f20f5911181fb761dd

Chalard Jean   commited 2023-10-03 21:30:49 +09:00
14499f0119
Merge "Remove Ikev2VpnProfile related shims usage" into main am: 0509e0da16
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2764585

Change-Id: I16a43aff0260fc52488cf18a75732def3cbb9e2b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Chiachang Wang   authored and   Automerger Merge Worker   commited 2023-10-03 08:16:09 +00:00
1f47e6f2e6
Merge "Remove Ikev2VpnProfile related shims usage" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-10-03 07:45:41 +00:00
0509e0da16
Remove an NPE in tearDown
This is masking an exception in setUp() and makes debugging difficult

Test: treehugger
Change-Id: I8b5b80c4171d45076dd02bab5ff4b6dc81d98086

Chalard Jean   commited 2023-10-03 16:01:00 +09:00
ec0149f1ba
Disable the remaining VPN CTS tests on watches.
- Watches don't support VPN apps.
- The HostsideVpnTests CTS tests are already skipped on watches.
- The tests for VpnManager VPNs do run on watches, but there isn't
  actually a way to start a VpnManager VPN on a watch because there is
  no way to display the consent dialog to the user.
- The VpnService CTS tests verify the VpnService API on watches
  bypassing the consent dialogs.
- Because there is no way to start a VPN app on a watch, there's no
  point requiring the VPN CTS tests to pass.

This CL disables the remaining VPN CTS tests on watches. This allows
watches to disable the VPN service, reducing startup time and memory
usage.

Bug: 286240194
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: Idb7110232ae7e45cafc265cd4f955c2a6b22361c

abdelrahmani   authored and   Lorenzo Colitti   commited 2023-10-02 06:29:46 +00:00
5bcbbc1ce9
Lower CLAT max MTU from 65536 to 1528. am: 9f94648b7f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2677095

Change-Id: Ifb1bc76f95e8eef24ed12a65fdf0a8cd4b4d360c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Maciej Żenczykowski   authored and   Automerger Merge Worker   commited 2023-09-30 19:58:41 +00:00
5d4d419b97
Lower CLAT max MTU from 65536 to 1528.
Android's clat is for reaching the internet, which in general
never has an ipv4 L3 mtu higher than 1500.

(We could probably hit this on a jumboframe enabled IPv6-only
wifi network [ http://b/292057969#comment18 ] where RA claims
MTU of 9K [9170])

Bug: 292057969
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7a32455571458b8a3f1121ad980d54323b2ef06b

Maciej Żenczykowski   commited 2023-09-30 14:23:51 +00:00
9f94648b7f
Merge changes I52fcfd3f,I6de4abdc,I1e8944de,I9525bfe0,Ife09fef8, ... into main am: 868859d4ef
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2411144

Change-Id: I3be1739824cd0051db27a1c134de7f209bbf992b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Jean Chalard   authored and   Automerger Merge Worker   commited 2023-09-30 05:10:20 +00:00
af5fb4dfdc
Merge "Remove debug only restrictions to network tracing" into main am: 06c8691fe0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2768925

Change-Id: I3a5de68794272cd076d8ab7f90b7c8659c2d2ab9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2023-09-30 05:10:03 +00:00
abb723ab5e
Merge changes I52fcfd3f,I6de4abdc,I1e8944de,I9525bfe0,Ife09fef8, ... into main
* changes:
  Use carrier service changed callbacks when flag is on
  Delete slots as the listeners are unregistered.
  Have a full class (not inline) for privilege listener
  Update the carrier service UID when onCarrierServiceChanged
  Pass the modem count to registerCarrierPrivilegeListeners
  Reorder add/remove/register/unregister carrier listeners

Jean Chalard   authored and   Gerrit Code Review   commited 2023-09-30 04:40:31 +00:00
868859d4ef
Remove debug only restrictions to network tracing
Network tracing was only available on userdebug and eng builds. This
change makes it available on all build types behind a flag.

Bug: 298197881
Test: flash & trace, toggle flag on/off
Change-Id: I75d854aee74adf7e23f7a970b20233790f9b0354

Ryan Zuklie   commited 2023-09-29 16:52:11 -07:00
9fb8f18c1b
Merge changes Ifd7abd8a,I39cab8ff,I6b3270d6,Ia28c6abc,If47d7e23 into main am: 1d600f4300
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2405726

Change-Id: I9867b0c48537dd0164a3858328c865c667847289
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Jean Chalard   authored and   Automerger Merge Worker   commited 2023-09-29 07:07:23 +00:00
6d5e0ad07e