Commit Graph

92711 Commits

Author SHA1 Message Date
Jean Chalard
8694130cac Merge changes Ic490fee6,If78047c3 into main am: 10353d5351
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2539630

Change-Id: I7a9c109e61759eca22722bc68b08c8f78f80ac94
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 11:39:09 +00:00
Jean Chalard
10353d5351 Merge changes Ic490fee6,If78047c3 into main
* changes:
  Add hidden constants for communicating about local network agents
  Use isAtLeast* from deps
2023-10-12 11:01:36 +00:00
Hansen Kurli
ed972a6fd2 Ensure nri is satisfied before returning.
When a network preference is set, the highest priority nri will
be a managed default request that disallows default networking.
In the case where there is no satisfying network,
mNoServiceNetwork is used as the satisfier instead of null.
(see computeNetworkReassignment)

mNoServiceNetwork should not be returned in any public API.
Check for the nri being satisfied before returning the satisfier
to ensure mNoServiceNetwork is not returned.

Fixes: 301222648
Test: atest FrameworksNetTests
Change-Id: I22d67a7e8d0274d8ad4f6123fbedf6d37eed18e7
2023-10-12 18:48:57 +08:00
Hansen Kurli
48c14686a3 Add testLockdownVpn that mocks platform VPN.
Add a test for lockdown vpn that uses TYPE_IKEV2_IPSEC_PSK and
mocks platform VPN by override in startLegacyVpnPrivileged().
In the context of ConnectivityService, setVpnDefaultForUids()
is the main interaction.

Refactor testLegacyLockdownVpn to take a VpnProfile and assert
behaviors with and without setVpnDefaultForUids().
This includes:
    1. Updating callback asserts and assertActiveNetworkInfo to
       reflect setVpnDefaultForUids().
    2. Adding TODOs where mCm.getActiveNetworkInfo() returns
       unexpected values.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: Ida4a4bc745af5ba2fc251795b2ffca56ead79b7f
2023-10-12 18:48:24 +08:00
Paul Duffin
886a679eb5 Merge "Revert "Ignore @FlaggedApi annotated API in udc mainline branch"" into udc-mainline-prod 2023-10-12 10:23:25 +00:00
Motomu Utsumi
12f1597804 Merge "Update mActiveIdleTimers to use netId as a key" into main am: 9b6420bc13
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2606672

Change-Id: I349e5566faba273f6acc6542cd17f37bb2cd23e0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 09:43:45 +00:00
Motomu Utsumi
9b6420bc13 Merge "Update mActiveIdleTimers to use netId as a key" into main 2023-10-12 09:10:22 +00:00
Motomu Utsumi
6473aede2e Revert "Ignore @FlaggedApi annotated API in udc mainline branch"
This reverts commit 9ee37a0e60.

Reason for revert: API files are not correct in udc-mainline-prod

Change-Id: Ief0a79883bcc2c5493807c548cb71ef655abed23
2023-10-12 08:40:37 +00:00
Paul Hu
b79fb66be2 Merge "Stop the created handler threads on the tests" into main am: 0b5d785096
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2784088

Change-Id: I2e9a1ab99077c3e6dd3036b87f97239581a20f46
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 07:47:58 +00:00
Paul Hu
0b5d785096 Merge "Stop the created handler threads on the tests" into main 2023-10-12 07:13:30 +00:00
Chalard Jean
d6f4efb1a8 Add hidden constants for communicating about local network agents
Test: FrameworksNetTests
Change-Id: Ic490fee6ee70d74acff0a290199b2946817173d0
2023-10-12 13:30:49 +09:00
Chalard Jean
5efbcf7bab Use isAtLeast* from deps
CSTest and CSAgentWrapper need to agree on what the current
version is

Test: CSTest*
Change-Id: If78047c36ce213a531207d25b410e870691fbb98
2023-10-12 13:30:49 +09:00
Motomu Utsumi
844ae9e435 Add PACKAGE_USAGE_STATS permission to ConnectivityServiceIntegrationTest
Bug: 303299687
Test: atest
(cherry picked from https://android-review.googlesource.com/q/commit:aa2f4d839ef127273406bbfb86a2d0d22180573f)
Merged-In: Iad740804a59599dd33add1ea85aa4771e0e4bd35
Change-Id: Iad740804a59599dd33add1ea85aa4771e0e4bd35
2023-10-12 03:00:50 +00:00
Jean Chalard
de72505109 Merge changes Ibb8d33b7,Ie168fe1f,I9f699b63 into main am: 02193c0cce
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2775660

Change-Id: I08e845ac61b6e37e88eacc3f48964742da708b61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 02:48:04 +00:00
Paul Hu
ebbbf8f470 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
2023-10-12 10:25:03 +08:00
Jean Chalard
02193c0cce 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
2023-10-12 02:14:52 +00:00
Jihoon Kang
9df878785f Merge "Prepare for keeping concrete overrides of abstract methods" into main am: 415773ed06
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2781647

Change-Id: I33c7e6c3198e863941ee3a03175dc73cc76a6ea5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 21:39:39 +00:00
Jihoon Kang
415773ed06 Merge "Prepare for keeping concrete overrides of abstract methods" into main 2023-10-11 21:02:18 +00:00
Hansen Kurli
d6aef6b6c3 Merge changes Ib24809ec,Id9d26435 into main am: 270813c4c5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2727558

Change-Id: Ic0fb2ca5c7aaebf9ac6597f1c19e71b7979339a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 12:35:59 +00:00
Hansen Kurli
270813c4c5 Merge changes Ib24809ec,Id9d26435 into main
* changes:
  Remove the fail case on IPv6 in testLockdownVpn
  Remove LockdownVpnTracker from testLegacyLockdownVpn
2023-10-11 12:03:37 +00:00
Treehugger Robot
4a01efa882 Merge "Add TrunkStable.bp" into udc-mainline-prod 2023-10-11 10:13:40 +00:00
Chalard Jean
cf7dbcae41 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
2023-10-11 17:02:52 +09:00
Chalard Jean
c517fb1247 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
2023-10-11 17:02:52 +09:00
Chalard Jean
026ca940d9 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
2023-10-11 17:02:51 +09:00
Motomu Utsumi
d590d88294 Add TrunkStable.bp
All the branches except udc-mainline-prod have TrunkStable.bp.
So this CL adds this file to avoid conflicts.
TrunkStable.bp is not included by Android.bp in udc-mainline-prod.
So, this CL is a no-op.

AOSP-first: TrunkStable.bp exists in aosp
Test: TH
Merged-In: Ib69d2fdc1d73b36a08a3d8ae1f2c45b2bcffae64

Change-Id: Ib3fe0774086ab5531f0e4d776da23667d32daad4
2023-10-11 06:56:09 +00:00
Maciej Żenczykowski
7dd74423c4 build netbpfload into the tethering apex am: a2a3d754a6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2781564

Change-Id: I2551e588e692428c67dc6a48a563e92e693a2d23
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 04:07:43 +00:00
Maciej Żenczykowski
a2a3d754a6 build netbpfload into the tethering apex
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id68aece26115808c2b1b795b9395208f5066f87c
2023-10-10 16:51:01 -07:00
Maciej Żenczykowski
ce8805af92 Merge changes from topic "netbpfload" into main am: 9c01dd494d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2779973

Change-Id: I18eac603991a538352700abbc3780d726477a24c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 17:43:12 +00:00
Chalard Jean
ef86df81d1 Reword a comment for accuracy am: f70919fbec
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2780320

Change-Id: Iefc882167d6bedc60da0ceac4dc522280de3ee0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 17:42:36 +00:00
Maciej Żenczykowski
9c01dd494d Merge changes from topic "netbpfload" into main
* changes:
  netbpfload: remove netbpfload.rc
  netbpfload: remove support for limiting selinux contexts
  netbpfload: do not create /sys/fs/bpf/loader subdir
  type safety for 'bool downstream'
  type safety for 'bool updatetime'
2023-10-10 17:23:50 +00:00
Paul Duffin
7bd2d108ea Prepare for keeping concrete overrides of abstract methods
Currently, metalava will discard concrete overrides of abstract methods
from the API signature files which causes problems when attempting to
generate stubs from those files and also discards information that may
be important in API reviews. This change is the first step in the
process of changing that behavior.

This change hard codes the current behavior for discarding the concrete
overrides (`add-additional-overrides=no`) into those signature files
that will (or are likely) to be affected by the change in behavior.
That allows the default behavior to be changed for all the other files
without affecting these.

Follow up changes will remove the hard coding from the signature files
and will update the contents which will include the concrete overrides
of the abstract methods.

More information and the background for this change is available at
go/add-overriding-one-pager.

Test: m checkapi
Bug: 299366704
Change-Id: I52c5bbe2e3bbd36019fe44fcb0b2d19876a5a869
2023-10-10 17:11:25 +01:00
Chalard Jean
263ccdc8e9 Allow for mocking an SDK in the tests am: eb66389d6a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2775659

Change-Id: I60d5476fa57a2e30233944e30270ed4e6b9239e7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 11:48:05 +00:00
Chalard Jean
f70919fbec Reword a comment for accuracy
Test: none needed
Change-Id: I7e409827adc86fc13975f394100889a6bf0f1e50
2023-10-10 20:12:40 +09:00
Maciej Żenczykowski
1d2c93d568 netbpfload: remove netbpfload.rc
I think it's better to just put this in bpfloader.rc,
where we can guarantee the correct ordering.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie2c5ab1cb1de015397ac54867ae6bb0c4321d207
2023-10-10 03:46:06 -07:00
Maciej Żenczykowski
af07d6db1f netbpfload: remove support for limiting selinux contexts
No need for this, as we simply only support those selinux
contexts (and directories) which are available to networking.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I35b134c57411f82514b9f7148411f83d3aee1927
2023-10-10 03:46:06 -07:00
Maciej Żenczykowski
857399114e netbpfload: do not create /sys/fs/bpf/loader subdir
(it's already created by the platform bpfloader)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie22f585cab17fd2bded3d97a9cfe1019b792b69d
2023-10-10 03:37:14 -07:00
Maciej Żenczykowski
e1a615ad83 type safety for 'bool downstream'
funky naming 'stream.down', because downstream.downstream is just too long...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id234654fa8960e7430fc33119f36fd94b858d242
2023-10-10 03:37:14 -07:00
Maciej Żenczykowski
8a6c6d50c0 type safety for 'bool updatetime'
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I99d51524ba913c46bad64b89778c01164639c85e
2023-10-10 03:37:14 -07:00
Maciej Żenczykowski
e87008b09a Merge "Use libbase properties for a slight simplification." into main am: af11354ba5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2779437

Change-Id: Iadb9463a04c141216e77acbb2f0ebccba1bf8289
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 06:44:59 +00:00
Chalard Jean
eb66389d6a Allow for mocking an SDK in the tests
Test: in followup patches
Change-Id: I540ce2a455c92be52eb94fbd4b54a2081d04d25e
2023-10-10 14:57:22 +09:00
Maciej Żenczykowski
af11354ba5 Merge "Use libbase properties for a slight simplification." into main 2023-10-10 05:56:01 +00:00
Jean Chalard
e3bfadb824 Merge "Expose the netd mock in CSTest to allow verifying calls on it" into main am: 4dec273ab4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2775658

Change-Id: I7463e8b960aba0346eeaec399d3c31dc7a612a2c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 04:45:55 +00:00
Jean Chalard
3f1ef8721a Merge "Add missing copyright notices to tests" into main am: e339c6b780
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2775657

Change-Id: I05724882a4820db75cca16baf4280948f0d69be8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 04:45:37 +00:00
Jean Chalard
4dec273ab4 Merge "Expose the netd mock in CSTest to allow verifying calls on it" into main 2023-10-10 04:17:29 +00:00
Jean Chalard
e339c6b780 Merge "Add missing copyright notices to tests" into main 2023-10-10 04:16:52 +00:00
Treehugger Robot
88a64da5fc Merge changes I163e21fd,I1b0943d3,I3af8e7f1 into main am: 962ac591bc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2776077

Change-Id: I4b69888e8b032768eb8019dad0dd073e205b153c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 03:56:01 +00:00
Xiao Ma
175d2b59a4 Merge "Move the delegated prefix validity check to IaPrefixOption class." into main am: a1eb2e453f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2777291

Change-Id: I49c51cf143719b2ddc4d852eee5d2ae7c9133b56
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 03:55:45 +00:00
Treehugger Robot
962ac591bc Merge changes I163e21fd,I1b0943d3,I3af8e7f1 into main
* changes:
  netbpfload: remove support for limiting program types
  netbpfload: remove non-network program types
  netbpfload: add Android.bp file
2023-10-10 03:52:05 +00:00
Xiao Ma
a1eb2e453f Merge "Move the delegated prefix validity check to IaPrefixOption class." into main 2023-10-10 03:27:35 +00:00
Elliott Hughes
497e3e05a5 Use libbase properties for a slight simplification.
Test: treehugger
Change-Id: If699230d0bf71ce521d7175da707e42b78ae4886
2023-10-09 23:57:48 +00:00