Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
Merge "Revert "Test if VPN app can grant ACTIVATE_PLATFORM_VPN with CON...""
Lucas Lin   authored and   Gerrit Code Review   commited 2022-08-25 05:41:01 +00:00
e87c1e0187
Merge changes Id6ae7929,I70474ef5,I4958df65,Ifc0e1ba2
* changes:
  ethernet: remove callback from factory updateInterfaceLinkState
  ethernet: updateConfiguration result should not rely on ip provisioning
  ethernet: remove callback boilerplate from EthernetNetworkFactory
  ethernet: add EthernetCallback class to wrap OutcomeReceiver

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-08-24 17:45:04 +00:00
f37e7c645b
Merge "Add tests for callback visibility"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-08-24 09:51:36 +00:00
38a01e080d
Merge "Add null check for clientInfo"
Paul Hu   authored and   Gerrit Code Review   commited 2022-08-24 03:54:49 +00:00
f37dfa3a11
Merge changes from topic "cookie_tag_map_raw_dump"
* changes:
  Add option to dump cookieTagMap in base64 format
  Use BpfDump#fromBase64EncodedString

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-24 03:16:53 +00:00
9988869442
Merge "Decouple VpnManagerService from ConnectivityServiceTest"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-08-24 03:05:24 +00:00
cbe38b46a2
ethernet: remove callback from factory updateInterfaceLinkState
updateInterfaceLinkState already returns true / false depending on the
success, so the EthernetCallback can be removed and sent from
EthernetTracker instead.

Test: atest EthernetManagerTest
Bug: 225317892
Change-Id: Id6ae7929097840ac5c9a4d244fdf669a06b94ed5

Patrick Rohr   commited 2022-08-23 13:07:57 -07:00
750036b286
Merge "Use PerUidCounter in the connectivity static library"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-23 18:25:03 +00:00
6a8166cf5e
ethernet: updateConfiguration result should not rely on ip provisioning
In addition, the result should always be success if the new
configuration is stored. This allows updating interfaces that are not
currently registered with ethernet service.

Bug: 236312641
Test: atest EthernetManagerTest
Change-Id: I70474ef5f046c65a6f74161137e25debd8dfe612

Patrick Rohr   commited 2022-08-23 11:01:47 -07:00
ea5c6dd136
Merge "Support java BpfMap in BpfNetMaps#swapActiveStatsMap"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-23 04:01:30 +00:00
405d676a08
Merge "Address comments on aosp/1781202"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-08-23 03:13:12 +00:00
595a98b352
ethernet: add EthernetCallback class to wrap OutcomeReceiver
The OutcomeReceiver that gets passed into the EthernetServiceImpl is
hard to use (it is nullable and both onError and onResult can throw
RemoteExceptions).

Note: This is an intermediary state.
The next step will be to completely tear EthernetCallback out of
EthernetNetworkFactory, which will remove a lot of boilerplate code.

Bug: 225317892
Test: atest EthernetManagerTest
Change-Id: Ifc0e1ba29ded933c418e4b335cb731c3496d7e44

Patrick Rohr   commited 2022-08-22 12:10:27 -07:00
251f2fcf13
Merge "Support java BpfMap in BpfNetMaps#setNetPermForUids"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-21 04:01:19 +00:00
618b9b0fa0
Merge "Check if VpnConfig#allowBypass is set or not"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-08-19 09:13:35 +00:00
d17c5ea7f0
Check if VpnConfig#allowBypass is set or not
Bug: 242931436
Test: atest FrameworksNetTests:VpnTest
Change-Id: I00e28717b35ed8b024b1d44e0689392d924c18bf

lucaslin   commited 2022-08-18 12:06:22 +08:00
03dcd7123f
Add option to dump cookieTagMap in base64 format
This is a preparation for testing SkDestroyListener that removes
cookieTagMap entry when socket is destroyed.

Bug: 217624062
Test: atest NetworkStatsServiceTest
Change-Id: Ia1091130101360e37557e6f00efe0f736134de05

Motomu Utsumi   commited 2022-08-18 13:00:33 +09:00
e6120b409f
Merge "fix clat on restricted networks"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-08-18 00:43:06 +00:00
22f0604474
Support java BpfMap in BpfNetMaps#swapActiveStatsMap
Bug: 217624062
Test: atest BpfNetMapsTest
android.net.cts.NetworkStatsManagerTest
android.net.cts.TrafficStatsTest

Change-Id: I9cb673673d2ed1dda8fa14c0877e2fc683267791

Motomu Utsumi   commited 2022-08-17 14:40:53 +00:00
7abeaa499c
Support java BpfMap in BpfNetMaps#setNetPermForUids
Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Ia32a73a49ee6a0b05e1abd0c09766e7769e7e760

Motomu Utsumi   commited 2022-08-17 14:20:13 +00:00
65271207f6
Decouple VpnManagerService from ConnectivityServiceTest
The test scope of ConnectivityService should verify how and
what ConnectivityService works in the unit test, so remove
the VpnManagerService related mocking from ConnectivityServiceTest.

This commit replaces the way to handle package added/remove and
user unlock intent in VpnManagerService. The flows interacting
with those intents in VpnManagerService are verified in
VpnManagerServiceTest, so unit test still maintains the same
coverage.

Bug: 230548427
Test: atest ConnectivityServiceTest
Change-Id: Ia2279bd1023296e3c949fa05bd74e921bf17da79

chiachangwang   commited 2022-08-17 14:15:44 +00:00
4597a749cb
Use PerUidCounter in the connectivity static library
This is a no-op refactoring which uses common PerUidCounter
from the static library and delete the private implementation
inside ConnectivityService. This refactoring includes:
  1. Make a private implementation that inherite PerUidCounter
     to convert and rethrow exception to maintain backward
     compatibility.
  2. Adjust per-uid max limit argument in the counter constructor
     since the private implementation is already buggy.
  3. Use the getter in PerUidCounter for the existing tests.

Test: testNetworkCallbackMaximum
      testProfileNetworkPrefCountsRequestsCorrectlyOnSet
      testRequestCountLimits
Bug: 235771502
Change-Id: I5c49edab18774acf819828201041c9931fabccc4

Junyu Lai   commited 2022-08-17 15:50:39 +08:00
00d92df645
Address comments on aosp/1781202
This also imports FunctionalUtils (ex-ExceptionUtils) with
its new name, as the companion change changes the name of
that class.

Test: ConnectivityServiceTest
Change-Id: I3fbc28835419864e536dd6727670328658a9b7cf

Chalard Jean   authored and   Jean Chalard   commited 2022-08-17 07:11:55 +00:00
9cc32051ac
Revert "Test if VPN app can grant ACTIVATE_PLATFORM_VPN with CON..."
Revert "Grant the ACTIVATE_PLATFORM_VPN appop if VPN app has CON..."

Revert submission 2141595-GRANT_PLATFORM_VPN

Reason for revert: Refer to the comment in ag/19491935.
Reverted Changes:
I0e0566bb8:Grant the ACTIVATE_PLATFORM_VPN appop if VPN app h...
I0580baca6:Test if VPN app can grant ACTIVATE_PLATFORM_VPN wi...

Change-Id: I9208fc124a5d37014b28e531da271e43e47c165a

Lucas Lin   commited 2022-08-17 06:31:29 +00:00
1d68ed690d
fix clat on restricted networks
this is the case for example when a tethering dun is in use

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

Maciej Żenczykowski   authored and   Lorenzo Colitti   commited 2022-08-16 10:28:09 +00:00
ef4b1bc50f
Add tests for callback visibility
Test: this
Change-Id: Ic1d8fab0105c2fa29536795a1c1359a026009fac

Chalard Jean   commited 2022-08-16 17:34:06 +09:00
8aa28fe733
Add null check for clientInfo
If the binder death notification for a INsdManagerCallback was
received before any calls are received by NsdService, the
clientInfo would be cleared and cause NPE. Thus, add a null check
to prevent crash.

Bug: 241741274
Test: atest FrameworksNetTests
Change-Id: Iebe761cd579bf3ee46ead389620bed60a21e3154

Paul Hu   commited 2022-08-16 07:21:55 +00:00
116b4c0b6b
Merge "ethernet: replace netd link observer with NetlinkMonitor" am: ab97a38ba8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2180636

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

Patrick Rohr   authored and   Automerger Merge Worker   commited 2022-08-12 15:59:11 +00:00
7b0fa6f14d
Merge "ethernet: replace netd link observer with NetlinkMonitor"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-08-12 15:55:44 +00:00
ab97a38ba8
Merge "Remove filegroup connectivity-module-utils-srcs in connectivity." am: 7f15ce1d9c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2153736

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

Xiao Ma   authored and   Automerger Merge Worker   commited 2022-08-12 09:24:40 +00:00
ace5b3635b
Merge "Remove filegroup connectivity-module-utils-srcs in connectivity."
Xiao Ma   authored and   Gerrit Code Review   commited 2022-08-12 09:06:58 +00:00
7f15ce1d9c
ethernet: replace netd link observer with NetlinkMonitor
The netd based InterfaceObserver uses two different netlink sockets for
updates on interface added / removed and link up / down events. This
means that these events are not ordered, which causes lots of
interesting issues in the ethernet service. Netd does not use
RTM_DELLINK at all, so this code has to use NetlinkMonitor to do
implement its own link tracking.

The EthernetManagerTests are currently disabled. There are still a
couple of flakes: one due to some link state issue which stops occurring
when bringing up the interface in TestNetworkService (weird -- I don't
yet know why this happens). Another due to the maybeTrackInterface
looking at the running flag (which races with the bringup code).

Test: atest EthernetManagerTest
Bug: 218785176
Bug: 234314411
Change-Id: I92b737f693402c1a8fd0a864736673de94904f2d

Patrick Rohr   commited 2022-08-11 11:40:54 -07:00
734f24e6d7
Merge changes I1cf472bd,Ibdaf2b23,I6967ad6f,I65f522c2,I0f220d1f, ... am: a3340c1355
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2001790

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

Paul Hu   authored and   Automerger Merge Worker   commited 2022-08-10 02:17:26 +00:00
36b1e1eefc
Merge changes I1cf472bd,Ibdaf2b23,I6967ad6f,I65f522c2,I0f220d1f, ...
* changes:
  Make the temporary NC sanitized instead of inlining
  Remove the legacy int from FullScore.
  Remove accessors for legacy int score from NAI
  Log the creation time of network agents
  Show time taken by the rematch
  Address some IDE warnings in ConnectivityService
  Copy arguments from NetworkAgent registration early

Paul Hu   authored and   Gerrit Code Review   commited 2022-08-10 01:41:43 +00:00
a3340c1355
Merge "Force specifying sanitized/not sanitized in caps from agent" am: 1896d713cc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2001256

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

Paul Hu   authored and   Automerger Merge Worker   commited 2022-08-09 09:35:31 +00:00
69213fd19c
Merge "Stop calling setAlwaysOnPackage from VpnManagerService" am: 588e1bde6f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2174906

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

Chiachang Wang   authored and   Automerger Merge Worker   commited 2022-08-09 09:35:19 +00:00
6135c3b4ba
Merge "Force specifying sanitized/not sanitized in caps from agent"
Paul Hu   authored and   Gerrit Code Review   commited 2022-08-09 09:16:21 +00:00
1896d713cc
Merge "Stop calling setAlwaysOnPackage from VpnManagerService"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-08-09 09:02:50 +00:00
588e1bde6f
Merge "Verify lock down related flows" am: f575c79c01
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2146966

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

Chiachang Wang   authored and   Automerger Merge Worker   commited 2022-08-08 01:13:33 +00:00
ef3f9de521
Merge "Verify lock down related flows"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-08-08 00:52:04 +00:00
f575c79c01
Stop calling setAlwaysOnPackage from VpnManagerService
To decouple VpnManagerService from ConnectivityServiceTest, stop
calling setAlwaysOnPackage from VpnManagerService as a
preparation for the follow up changes. Update it to equivalent
calls from Vpn directly.

The VpnManagerService variable is still needed because tests
have indirect calls via sending intent to update the lock
down behavior.

Bug: 230548427
Test: atest ConnectivityServiceTest
Change-Id: Ib78ac8173b2a4d2a8e9845e943eb63d79c36218c

chiachangwang   commited 2022-08-08 00:50:54 +00:00
3797f878ac
Merge "Cleanup constructor of NetworkStats#Entry" am: 0ab4d265d6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2167482

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

Aaron Huang   authored and   Automerger Merge Worker   commited 2022-08-05 08:37:59 +00:00
4705518156
Merge "Cleanup constructor of NetworkStats#Entry"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-08-05 07:46:28 +00:00
0ab4d265d6
Verify lock down related flows
This commit verifies the lock down related flows:
- When a user present
- When lock down is reset
- Create LockdownVpnTracker
- isVpnLockdownEnabled(int)
- getVpnLockdownAllowlist(int)

Bug: 230548427
Test: atest VpnManagerServiceTest
Change-Id: Ic42d884b64d2c7ec0caf9dff95d94fc5e52456b2

chiachangwang   commited 2022-08-05 02:00:16 +00:00
7b8b264315
Merge changes I036b7f23,I53c58e7b am: bdedaacd88
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2173585

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-08-04 10:25:20 +00:00
eea540837c
Merge changes I036b7f23,I53c58e7b
* changes:
  Improve the JavaDoc for FIREWALL_CHAIN_OEM_DENY_x.
  Allow tests to set the NetworkAgent's callbacks when creating it.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-04 09:50:53 +00:00
bdedaacd88
Force specifying sanitized/not sanitized in caps from agent
To make sure anyone using the capabilities originally from
the agent have to know what they're dealing with, make the
member private and make accessors that spell out explicitly
the important parts.

This is the last step towards addressing the leftover
comment from aosp/1958906.

Bug: 238139913
Test: FrameworksNetTests CtsNetTestCases
Change-Id: I9fc1986c59726212acfc2ad921745c8bbc424035

Chalard Jean   authored and   Paul Hu   commited 2022-08-04 06:45:39 +00:00
39b12d4b8f
Remove the legacy int from FullScore.
This is a nice cleanup and will clear misunderstandings where
people mistakenly look at it in the logs.
Unfortunately it can't be removed from NetworkScore because there
are public APIs, and it's even used to transmit invincibility in
a legacy spur.

Bug: 238139913
Test: ConnectivityServiceTest
Change-Id: Ibdaf2b235b994383d5f8f42f1780b04bda80c93a

Chalard Jean   authored and   Paul Hu   commited 2022-08-04 06:45:39 +00:00
0158fe9fd1
Remove accessors for legacy int score from NAI
These are no longer useful. Also, NAI no longer needs to
be comparable, and it should no longer be – comparing 2
NAIs only make sense in the context of a specific request.

Bug: 238139913
Test: ConnectivityServiceTest IpConnectivityMetricsTest
Change-Id: I6967ad6f08380213c29f3d47d6422f8bbea1946c

Chalard Jean   authored and   Paul Hu   commited 2022-08-04 06:45:39 +00:00
aa5bc624f6
Merge changes I71988117,Ia70379a3 am: 31b48fa787
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2165825

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

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-08-03 12:07:51 +00:00
4f6d11e04f
Merge changes I71988117,Ia70379a3
* changes:
  Move app uid stats map dump to NetworkStatsService
  Move uid counter set map dump to NetworkStatsService

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-03 11:34:39 +00:00
31b48fa787