Commit graph android_packages_modules_Co.../tests/unit/java
Message SHA1
Merge "Make sure the right NetworkMonitor start method is called on S-/T+"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-25 02:23:09 +00:00
894912c85e
Merge "Fix : recent Connectivity module with old NetworkStack module"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-02-22 19:32:54 +00:00
b30e957777
Make sure the right NetworkMonitor start method is called on S-/T+
Test: ConnectivityServiceTest
Change-Id: I6a7f0143082236e30d2e3878147df2c921ff5539

Chalard Jean   commited 2022-02-23 04:31:26 +09:00
cd8210843f
Merge changes Ib1cd342a,Iab23d414
* changes:
  Add an IS_DESTROYED flag to FullScore.
  Use MessageUtils instead of hardcoded strings in policyNameOf.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-22 09:26:38 +00:00
1c5ce5542a
Merge "Mock more resources for VPNs."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-22 09:10:42 +00:00
16040b1833
Add an IS_DESTROYED flag to FullScore.
This is being added as the lowest priority score factor, just
above the tie-breakers. It ensures that a network that has been
destroyed will lose to another identical network that has not
been destroyed, but will otherwise be scored identically.

The flag is a CS-managed flag that is stored in NetworkAgentInfo.
Currently it is always false, but it will be populated in
future CLs.

Bug: 216567577
Test: atest FrameworksNetTests
Change-Id: Ib1cd342ab7dfc4df45715da19b743d711fe8d605

Lorenzo Colitti   commited 2022-02-22 16:39:44 +09:00
8c7a8860f9
Merge "Mock resources used directly by LockdownVpnTracker."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-22 01:59:20 +00:00
2606d9c862
Mock more resources for VPNs.
These also cause ConnectivityCoverageTests to fail when built
from master and run on S. They are used in Vpn.java, not
LockdownVpnTracker.

They were not addressed in the previous CL because running this
test locally is difficult.

Test: forrest
Change-Id: I7d687338fd6bc7468b1abcae58898322554e647b

Lorenzo Colitti   commited 2022-02-22 10:17:09 +09:00
93a72d22a5
Mock resources used directly by LockdownVpnTracker.
LockdownVpnTracker directly uses resources from
com.android.internal.R. This is acceptable because it's platform
code. But ConnectivityServiceTest uses the LockdownVpnTracker
built from the module source tree, and when that code fetches
resources on a previous Android release, it crashes because the
resource IDs don't exist; non-public resource IDs aren't stable.

Fix this by mocking the resources used by LockdownVpnTracker.

Test: atest ConnectivityCoverageTests
Change-Id: I239a18a38d4f1082f76f5ff1b831c15ee753bdfd

Lorenzo Colitti   commited 2022-02-22 10:13:24 +09:00
19e6171926
Merge "Skip NetworkStatsServiceTest before T"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-19 20:20:24 +00:00
fc67ee8c71
Fix : recent Connectivity module with old NetworkStack module
This patch adjusts the behavior of the NetworkMonitor mock
to behave the same way as the real one – accept either
notifyNetworkConnected or notifyNetworkConnectedParcel as
a signal a network is connected. This is necessary because
the Connectivity module will call either of these depending
on versions of other software it finds on the device.

Test: ConnectivityServiceTest
      NetworkMonitorTest
Change-Id: I5900a019b3b033f4365d8a82b1e522336012064e

Chalard Jean   commited 2022-02-19 20:43:14 +09:00
a14b3f2184
Use MessageUtils instead of hardcoded strings in policyNameOf.
This makes the code easier to maintain because we do not need to
manually add string representations, and because it will throw at
static initialization time if the clas contains duplicate
POLICY_xxx values. The memory overhead is likely negligible.

Bug: 216567577
Test: new coverage in FullScoreTest
Change-Id: Iab23d414c8e28ff7f26060ad44fa996f277d361f

Lorenzo Colitti   commited 2022-02-19 19:45:43 +09:00
c6d3f3cf25
Skip NetworkStatsServiceTest before T
NetworkStatsService was mainlined in T, so the test does not need to be
run on previous Android versions.

Test: atest CtsNetTestCases:NetworkStatsServiceTest
Change-Id: I8e69746a03ef029b1121cc8fa71e299ac12c2905

Patrick Rohr   commited 2022-02-18 09:18:20 +01:00
e3b067f523
Add tests for deleteKernelTagData
Test: atest NetworkStatsServiceTest
Change-Id: I6db6b79314868271f877acf2a0b21699cbf02df5

Patrick Rohr   authored and   markchien   commited 2022-02-16 14:23:30 +08:00
f9888898e3
Fix NetworkStatsServiceTest after adding deleteKernelTagData
Test: atest NetworkStatsServiceTest
Change-Id: I667a5d86e0df8505fef549e598f3b4141637fb90

Patrick Rohr   authored and   markchien   commited 2022-02-16 14:01:29 +08:00
7c52b69b3e
Merge "Refer to SDK constant defined in DevSdkIgnoreRule"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-11 09:23:02 +00:00
5be94579d4
Refer to SDK constant defined in DevSdkIgnoreRule
Refer to the same constant definition as other tests instead of
hard coding locally, so that it won't be missed as changing to
Build.VERSION_CODES.SC_V2.

Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I3c17c414d830af03e2719c5dab1a664c55f6df2a

Chiachang Wang   commited 2022-02-11 07:40:58 +00:00
137bbed860
Merge "Add Low Power Standby test to NetworkManagementServiceTest"
Robert Horvath   authored and   Gerrit Code Review   commited 2022-02-10 11:17:44 +00:00
3a33495992
Merge "Change naming of excludeLocalRoutes"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-02-10 00:50:30 +00:00
84ad04f768
Merge changes from topic "bandwidth-limiting"
* changes:
  Add bandwidth limiting to CS
  Add setting that controls network rate limit

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-02-09 18:00:04 +00:00
6b5b7b40d8
Add bandwidth limiting to CS
Adds ingress rate limiting functionality to ConnectivityService. The tc
rate limit is installed before we tell netd about the interface, and
removed after the network is removed from netd. When the setting
changes, the old rate limit needs to be removed before a new one can be
added (unfortunately, we cannot use NLM_F_REPLACE when configuring the
tc-police filter).

Currently, this functionality is always enabled, but may or may not work
based on kernel support.

Bug: 157552970
Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I4e64b2c40490f061e42b40a1b1b3a6618c3d1a87

Patrick Rohr   commited 2022-02-09 14:46:26 +01:00
2857ac4dd0
Change naming of excludeLocalRoutes
Address API review feedback to change naming of
setExcludedLocalRoutesVpn and getter.

Bug: 217742354
Test: atest FrameworksNetTests
Change-Id: I57bbf55c7aba1c86ec8687d2431a50b37e63c6d0

Chiachang Wang   commited 2022-02-09 15:50:06 +08:00
f890874970
Pass the NetworkAgentConfig to NetworkMonitor.
When the network is a VPN, NetworkMonitor needs to know whether
the VPN requests validation, and that information is stored in
NetworkAgentConfig. Pass it.

Test: FrameworksNetTests
Change-Id: I3616f0796b69ce054d92213aafdef43ba7041596

Chalard Jean   commited 2022-02-09 15:19:38 +09:00
d490072cd6
Add and implement API for VpnManagers to request validation
This adds a new API that lets VPN apps using VpnManager request
that the platform run its basic validation check on the resulting
network.

Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I00092eee857d3e33529b19461cfd5dd060a0fe20

Chiachang Wang   authored and   Chalard Jean   commited 2022-02-08 22:47:26 +09:00
865511a8c4
Merge "Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator."
Jean Chalard   authored and   Gerrit Code Review   commited 2022-02-04 16:40:30 +00:00
d262e71965
Merge "Add APIs for discover/resolve on specific networks"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-02-04 12:07:38 +00:00
d61719c422
Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator.
Passing one of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED is
required for all code targeting T or above. The correct value
here is RECEIVER_NOT_EXPORTED because the receiver is being
registered in the system server and the broadcast comes from
the system server itself (same UID).

This does not need to be guarded by OS version because
CarrierPrivilegeAuthenticator is only used on T+.

Test: m
Fix: 217642082
Change-Id: I09840b17bd54352896607737b56c6a692ffbd2c2

Lorenzo Colitti   authored and   Chalard Jean   commited 2022-02-04 15:31:06 +09:00
7569d51446
Add APIs for discover/resolve on specific networks
Test that NsdManager specifies the correct network when a service is
discovered, and that services can be resolved on a specified network.
Also test that service discovery can be started on a specific network.

Bug: 190249673
Test: atest NsdManagerTest

Change-Id: Ie8b551ce9e33e3adf35f75508f91bbd0df71f837

Remi NGUYEN VAN   commited 2022-02-03 16:05:02 +09:00
06bdcec9fa
Add Low Power Standby test to NetworkManagementServiceTest
Bug: 190822356
Test: atest NetworkManagementServiceTest
Change-Id: I8ee0f5bc77efb94ba04957f68ec9b829d41bff83

Robert Horvath   commited 2022-02-02 22:54:21 +01:00
aa197190c6
Accept accessUids from telephony when it's the carrier config app
Test: FrameworksNetTests, new test in this patch
Change-Id: I50fab91e107c51d33a5e529c73b83db198a88d2c

Chalard Jean   commited 2022-02-02 13:52:25 +09:00
ac9ace0bbe
Clean up BpfNetMaps
Cleans up BpfNetMaps.java before enabling mainline code path.

Bug: 202086915
Test: atest FrameworksNetTests
Change-Id: I28e5d63ed4624df540b1ca47b71899cff7321ded

Ken Chen   authored and   Patrick Rohr   commited 2022-02-01 12:31:03 +01:00
f5f51339af
Merge changes Ifd6be50a,I857e40c9,I1b9f4fde,Ib3b43cf2
* changes:
  Prevent native_init from starting TrafficController
  Remove libutils dependency from libservice-connectivity
  Merge libtraffic_controller_jni into libservice-connectivity
  [NETD-TC#15] Make ConnectivityService and PermissionMonitor calls BpfNetMaps on T

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-01 03:02:36 +00:00
76709a18e9
Merge changes Id5e5b911,I8301abad,I7262811a,I658e579b,I7d43ef0e
* changes:
  Expose access UIDs.
  Send access UIDs to netd
  Add accessUids to NetworkCapabilities.
  Clean up restrictions on network agent capabilities
  Sanitize NetworkCapabilities from agent on the handler thread

Jean Chalard   authored and   Gerrit Code Review   commited 2022-02-01 00:45:55 +00:00
4fcb8ad292
Merge "Fix kernelToTag import in NetworkStatsFactoryTest."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-01-31 13:35:30 +00:00
d508855bb9
[NETD-TC#15] Make ConnectivityService and PermissionMonitor
calls BpfNetMaps on T

Since TrafficController moves to mainline module for T, so some netd binder
interfaces revelant to BPF are going to deprecated. Provide JNI APIs to
call TrafficController inside mainline module for T.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: Ib3b43cf2840e02806395af9f1e019ca6fccd032e

Wayne Ma   authored and   Patrick Rohr   commited 2022-01-31 09:19:08 +01:00
2fde98c87b
Send access UIDs to netd
Test: FrameworkNetTests CtsNetTestCases
Change-Id: I8301abaddf5850071fa23d41e8e736ab7071e299

Chalard Jean   commited 2022-01-31 17:04:58 +09:00
e6c9527554
Add accessUids to NetworkCapabilities.
For now, all entry points reject this. Followup changes
will allow the supported use cases.

Test: new unit tests and CTS for this in this patch
Change-Id: I7262811a2e46336d3bb63c80886fc0578a36da94

Chalard Jean   commited 2022-01-31 17:04:58 +09:00
9a30acf744
Allow Carrier app to request for CBS capability
Test: unit test and CTS
Bug: 194332512
Change-Id: I29680b56d790106ad082f1a398c2bddb030f834a

Sooraj Sasindran   commited 2022-01-30 12:12:17 -08:00
e9cd2084e4
Fix kernelToTag import in NetworkStatsFactoryTest.
NetworkManagementSocketTagger#kernelToTag is moving to
NetworkStatsFactory. Fix the import path in the test.

Test: atest FrameworksNetTest
Change-Id: I8797d9e589e68b4980ff5b38ba09d091420d30fd

Lorenzo Colitti   commited 2022-01-29 21:35:06 +09:00
f59770f769
Adjust NetworkStatsServiceTest to mock out the JNI.
Test: atest NetworkStatsServiceTest
Change-Id: Icdea9f871199f1e859aef647e5ba3dec7ac02d73

Lorenzo Colitti   commited 2022-01-28 18:16:39 +09:00
9fdbb7ec7d
Merge "Test UidCounterSetMap in NetworkStatsServiceTest"
Mark Chien   authored and   Gerrit Code Review   commited 2022-01-27 10:02:35 +00:00
dd26c5709e
Test UidCounterSetMap in NetworkStatsServiceTest
Test: atest FrameworksNetTests
Change-Id: I1ae720fcc3192712b3dcbe69619f97f7df1a1f5e

markchien   commited 2022-01-27 17:28:19 +08:00
8f3917501b
Merge "[MS59.2] Add unit test for NetworkStatsDataMigrationUtils"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-01-27 09:20:10 +00:00
bfdd0f3c3c
Merge "Change NETWORK_TYPE_5G_NSA reference package"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-01-27 08:36:23 +00:00
85a2ef3dd5
[MS59.2] Add unit test for NetworkStatsDataMigrationUtils
Test: atest NetworkStatsDataMigrationUtilsTest
Bug: 204830222
Change-Id: Ia6e8aec9a828072a2a1e63bec600c2e20d3699b3

junyulai   authored and   Junyu Lai   commited 2022-01-26 16:53:06 +00:00
a1bb3a36cd
Change NETWORK_TYPE_5G_NSA reference package
NETWORK_TYPE_5G_NSA is moved to NetworkStatsManager

Bug: 210073043
Test: builds, FrameworksNetTests
Change-Id: I9226119ee4f67688a1b4ffdab7e5a86ec0b8e974

Aaron Huang   commited 2022-01-26 23:41:17 +08:00
b4ce0fa9b1
Merge changes Ie826477d,I5125a3ac
* changes:
  [CLATJ#26] ClatCoordinator: reword clatd starting failure logging
  [CLATJ#25] ClatCoordinator: stop clatd process gracefully

Nucca Chen   authored and   Gerrit Code Review   commited 2022-01-26 14:50:11 +00:00
f8ed984e9c
[CLATJ#26] ClatCoordinator: reword clatd starting failure logging
Bug: 212345928
Test: build
Change-Id: Ie826477d27db26cc49d113ec8bfacaaa3006e26e

Hungming Chen   authored and   Nucca Chen   commited 2022-01-26 12:23:45 +00:00
6fb21144b8
[MS78.2] Fix NetworkIdentity#Builder crashing on 5G NSA networks
Test: atest NetworkIdentityTest
Fix: 216193400
Change-Id: I00abc97a98dfdf17d5f0c2e6b45d28be9899c5c3

Junyu Lai   commited 2022-01-26 07:53:57 +00:00
30f06afda3
Merge changes from topic "preparation_fork_clatd_from_system_server"
* changes:
  [CLATJ#24] ClatCoordinatorTest: add basic unit tests
  [CLATJ#23] Close the file descriptor manually
  [CLATJ#22] ClatCoordinator: stop clatd
  [CLATJ#21] ClatCoordinator: start clatd

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-01-26 00:26:48 +00:00
43f9729e90