Commit graph android_packages_modules_Co.../tests
Message SHA1
Merge changes I105ee1d6,I55817132 into main
* changes:
  Update ENABLE_MATCH_NON_THREAD_LOCAL_NETWORKS flag to target sdk 37
  Adopt mainline beta program for local network agent

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-21 10:28:00 -07:00
14debeb714
Merge "Support IpAddress type in LocalNetAccessKey for BPF" into main
Sarup Dalwani   authored and   Android (Google) Code Review   commited 2025-08-21 09:53:36 -07:00
9e567923d4
Merge "Add a offloadInfo map to better manage offload info" into main
Paul Hu   authored and   Android (Google) Code Review   commited 2025-08-21 01:54:29 -07:00
d50b9e40c6
Remove automotive MUMD workaround in ApfIntegrationTest.
As per `Iad43a122407fe438cab94f59ed8aba8d6080af02` commit, this test is no longer running on automotive.

This changelist also skips this test on Android Automotive within the setupOnce (@BeforeClass) method to avoid
executing unnecessary SLEEP/WAKEUP logic.

Fix: 439953326
Test: atest CtsNetTestCases:ApfIntegrationTest
Test: presubmit
Flag: TEST_ONLY
Change-Id: Ic96db7a5dbc3f793bef85d9d3cd10cbcf726c7b4

Antonio Kantek   commited 2025-08-20 13:23:15 -07:00
84dabda01a
Add a offloadInfo map to better manage offload info
Instead of iterating all listeners to get the FilterRepliesInfo,
this change introduces a new offloadInfo map to manage this
information. This map is updated when listeners are added/removed
or when a service is resolved. This ensures that the offload
information is always up-to-date and can be retrieved
efficiently.

Bug: 410734687
Test: atest ConnectivityCoverageTests
Flag: EXEMPT refactor
Change-Id: I89270c58304eec9fe9c3ed63dfbd46dab788a39f

Paul Hu   commited 2025-08-19 09:51:07 +00:00
1cf7a517fc
Adopt mainline beta program for local network agent
Unifies the `TETHERING_LOCAL_NETWORK_AGENT` and
`WIFIP2PGO_LOCAL_NETWORK_AGENT` legacy feature flags into a
single mainline beta aconfig flag:
`tethering_and_p2p_go_local_network_agent`.

This change simplifies the logic for enabling the `NetworkAgent`
for both standard tethering (global scope) and Wi-Fi P2P Group
Owner mode (local scope). The agent is now enabled for both use
cases when the new flag is on.

The implementation in `IpServer` and associated tests have
been updated to use the new unified flag.

Flag: com.android.tethering.mainline.beta.tethering_and_p2p_go_local_agent
Bug: 420590461
Test: atest TetheringTests
Test: adb root
      adb shell device_config put com_android_tethering com.android.tethering.mainline.beta.tethering_and_p2p_go_local_agent true
      adb reboot
      atest CtsTetheringTest --test-filter '.*Agent.*'
Test: atest ConnectivityCoverageTests:android.net.ip.IpServerTest --update-device
Change-Id: I55817132c57a04b4f7b7bac61b5741f45ba16182

Junyu Lai   commited 2025-08-19 14:16:23 +08:00
dc420ccccb
Support IpAddress type in LocalNetAccessKey for BPF
Updated LocalNetAccessKey to use Type.IpAddress for its
`remoteAddress` BPF field. This enables the BPF map to
store both IPv4 and IPv6 addresses for this key.

To ensure proper functionality with IPv6 addresses, a new
unit test, `testAddLocalNetAccessAfterV_withIPv6`, has been
added to BpfNetMapsTest.java. This test specifically
verifies adding and retrieving local network access rules
using an IPv6 remote address.

Bug: 392509494
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Flag: EXEMPT refactor
Change-Id: I005f4f2b778ca2d3a4e6578c1440162532f8d004

Sarup Dalwani   commited 2025-08-17 03:39:28 +00:00
ab9a3af782
Merge "Allow app-specific network creation with a new permission" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-14 23:04:19 -07:00
6f57c71c68
Allow app-specific network creation with a new permission
If an app registers a network agent and doesn't have NETWORK_FACTORY or
PERMISSION_MAINLINE_NETWORK_STACK, but does have
CREATE_APP_SPECIFIC_NETWORK, ConnectivityService will:
- Allow it to create a network
- Force the capabilities to contain only the app's UID
- Force the network to be restricted
- Ignore attempts to change the UID or make the network non-restricted

Test: TH
Flag: android.net.platform.flags.create_app_specific_network_permission
Bug: 435313135
Change-Id: I5a9517515e64f799c88aca4a51636b1a08e15817

Motomu Utsumi   commited 2025-08-15 12:54:49 +09:00
72d4b516c9
Merge "Mdns: Skip networks with NET_CAPABILITY_LOCAL_NETWORK" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-08-14 18:43:19 -07:00
a1400694b3
Merge "Add OffloadCallback interface" into main
Paul Hu   authored and   Android (Google) Code Review   commited 2025-08-14 09:03:46 -07:00
c37f3cf83d
Mdns: Skip networks with NET_CAPABILITY_LOCAL_NETWORK
MdnsSocketProvider expects no overlap between NetworkCallbacks,
Tethering, and Wifi P2P. However, local NetworkAgents can cause
overlap, leading to duplicate sockets. This commit fixes the issue by
skipping networks with NET_CAPABILITY_LOCAL_NETWORK.

Alternatively, the NetworkRequest should addForbiddenCapability
for local networks. However, since this is a module API, it is
not visible to standalone applications.

Flag: EXEMPT bug fix
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.mdns.MdnsSocketProviderTest \
      --update-device
Test: m service-connectivity-mdns-standalone-build-test
Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest \
      CtsNetTestCases:android.net.cts.NsdManagerDownstreamTetheringTest
Bug: 437038495
Change-Id: I78dd7d98ad80147ca26ec6130b6081ef4efb2ecc

Junyu Lai   commited 2025-08-14 20:44:36 +08:00
eb80e8ad9f
Merge "Use imported flag alias for readability" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-14 04:11:21 -07:00
d2b8f3fec2
Use imported flag alias for readability
Import `FLAG_QUEUE_NETWORK_AGENT_EVENTS_IN_SYSTEM_SERVER` and use
its alias in Connectivity Service tests.

Flag: com.android.tethering.mainline.beta.queue_network_agent_events_in_system_server
Fix: 428098184
Test: m
Change-Id: Ic4b5a144c00919defbd7a29048957f028c80bf4a

Junyu Lai   commited 2025-08-14 16:30:32 +08:00
25bd5eaf24
Merge "Use mainline beta flag for NetworkAgent event queueing" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-08-14 01:19:15 -07:00
0c6b14587b
Merge changes I69ad789f,I5954b196 into main
* changes:
  Fix mobile data preferred on multi-user devices.
  Support multi-user SettingsObservers in ConnectivityService

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-14 00:33:06 -07:00
4c516ffd67
Use mainline beta flag for NetworkAgent event queueing
Add `queue_network_agent_events_in_system_server` as a mainline beta
flag. This flag replaces the previous check for
`mQueueNetworkAgentEventsInSystemServer`, allowing the feature to be
controlled and enabled on all Android versions via mainline beta program.

Flag: com.android.tethering.mainline.beta.queue_network_agent_events_in_system_server
Test: atest ConnectivityCoverageTests --update-device \
      --test-filter '.*NetworkAgent.*'
Test: atest ConnectivityCoverageTests --update-device \
      --test-filter '.*Connectivity.*'
Fix: 428098184
Change-Id: I96b0443bd4c55c28d482349738bbdc4798f0c7f9

Junyu Lai   commited 2025-08-14 14:53:06 +08:00
c9890408bf
Add OffloadCallback interface
This commit adds the OffloadCallback, which is a common interface
to notify the offload service of info updates from MdnsAdvertiser.

Bug: 410734687
Test: atest ConnectivityCoverageTests NsdManagerTest
Flag: EXEMPT legacy refactor
Change-Id: I6bb7fe2b0e4ced4aff9062566d9bcf075893e6fc

Paul Hu   commited 2025-08-13 05:25:42 +00:00
dc188b57d8
BpfBitmap: some minor optimizations
Test: TreeHugger, atest BpfBitmapTest
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5acf5bcb31777e503e58cef733d617a53006d2b9

Maciej Å»enczykowski   commited 2025-08-12 16:02:23 -07:00
d2d26c661a
Merge "Add CDD annotation to APFv6 multi-device tests" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-08-10 18:40:25 -07:00
cee0bf0a8c
Merge "Add CDD annotation to APFv4 multi-device tests" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-08-10 18:40:07 -07:00
e6d8f3c4c5
BpfMap.h: introduce BpfMapRW
which allows writes, but not deletes.

This is technically what bpf map arrays are capable of.

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1f73bea5428c190af17442539c296282ce9e0786

Maciej Å»enczykowski   commited 2025-08-09 16:03:46 -07:00
8b96286200
Add CDD annotation to APFv6 multi-device tests
Annotate APFv6 multi-device tests with `@CddTest`.
This marks these tests for compliance with specific CDD requirements.

Flag: EXEMPT test only
Bug: 437029299
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Change-Id: I686ca609c3f34daf106673e429c49b8776c97923

Jimi Chen   commited 2025-08-08 13:09:52 +00:00
de501ab15a
Add CDD annotation to APFv4 multi-device tests
Annotate APFv4 multi-device tests with `@CddTest`.
This marks these tests for compliance with specific CDD requirements.

Flag: EXEMPT test only
Bug: 437034146
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV4Test
Change-Id: Ibdd4c1652e21a708d5ddde79ecedbe258e318ac3

Jimi Chen   commited 2025-08-08 13:09:36 +00:00
ec8252a44d
Fix mobile data preferred on multi-user devices.
The mobile data preferred feature stores the list of UIDs in
Settings.Secure, which is per-user. But the code only sets, reads
and observes the setting for the current user instead of for all
users. This does not work on HSUM or automotive.

Fix this as follows:
- Register the ContentObserver on UserHandle.ALL
- Any time the observer fires, read the setting on all current
  users, and operate on the merged result.
- Ensure that the code gets called on ACTION_USER_ADDED and
  ACTION_USER_REMOVED.

Because the code now aggregates the setting for all UIDs, it
should just work on single-user devices. It should also work if
there are OEM devices that store all UIDs (for all users) in
Settings.Secure for user 0.

Because the bug is fixed, re-enable the test on automotive.

Also fix style nits.

Fix: 404186833
Flag: EXEMPT bug fix
Test: covered by existing CTS tests
Change-Id: I69ad789f1c7c7f3bab04ab8789dfb93ee0de553d

Lorenzo Colitti   commited 2025-08-08 15:36:55 +09:00
2139fcf345
Support multi-user SettingsObservers in ConnectivityService
ConnectivityService uses SettingsObservers to detect when
settings change. These are all set on user zero. This is fine
for most settings, which are in Settings.Global, but some
settings are per-user, such as MOBILE_DATA_PREFERRED_UIDS, which
is in Settings.Secure.

This CL adds the ability to register SettingsObservers on all
users. These observers will fire any time the setting changes
for any current user, and any time a user is added or removed.

This CL does not add or change any SettingsObservers and should
cause no behaviour changes.

Bug: 404186833
Flag: EXEMPT refactor
Test: covered by existing tests
Change-Id: I5954b196eea776414098f1ce4441eb02065438ef

Lorenzo Colitti   commited 2025-08-08 15:36:54 +09:00
aad9267493
Merge "Add VSR annotation to APF multi-device tests" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-08-07 19:31:54 -07:00
283ff389ca
replace CookieTagMapKey with S64
(mostly autogenerated, with minor tweaks to make it build)

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2065c3fc6d4d37663a0a52281deb7624fd5c801d

Maciej Å»enczykowski   commited 2025-08-07 15:52:35 -07:00
9ef3916ba4
replace UidStatsMapKey with S32
(mostly autogenerated, with minor tweaks to make it build)

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id2ffe0df6526a6377806464e902b8e8f87a43c62

Maciej Å»enczykowski   commited 2025-08-07 15:50:48 -07:00
b28b0c70b9
Add VSR annotation to APF multi-device tests
Annotate APFv4 and APFv6 multi-device tests with `@VsrTest`.
This marks these tests for compliance with specific VSR requirements,

Flag: EXEMPT test only
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV4Test
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Test: ./cts-tradefed run cts \
      -m CtsConnectivityMultiDevicesTestCases \
      -t ApfV4Test --shard-count 2
Test: ./cts-tradefed run cts \
      -m CtsConnectivityMultiDevicesTestCases \
      -t ApfV6Test --shard-count 2
Change-Id: I864aa65f6f4d584c4f8077f98aac0b0da8e501c8

Jimi Chen   commited 2025-08-07 00:46:08 -07:00
752ea074e9
Merge "Change proto message name for NetworkConfigStoreProto" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-08-06 22:28:10 -07:00
7dc6767005
Change proto message name for NetworkConfigStoreProto
This patch add *Proto suffix for some proto message in
NetworkConfigStoreProto to avoid name conflicts with names in
android.net package.

Test: atest ConnectivityCoverageTests
Bug: 397536853
Flag: EXEMPT mainline

Change-Id: I4f826511bcab0fcd3b154bbc349a062fd4841321

Chuwei He   commited 2025-08-06 20:58:53 -07:00
88d424c3b8
Merge "Add EthernetConfigHolderProto to NetworkConfigStoreProto" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-08-06 20:37:00 -07:00
dc421c895e
Add EthernetConfigHolderProto to NetworkConfigStoreProto
This patch Adds EthernetConfigHolderProto to NetworkConfigStoreProto for storing
collective ethernet configurations state.

Test: atest ConnectivityCoverageTests
Bug: 397536853
Flag: EXEMPT mainline
Change-Id: I420c0775163b5608cb6defb35e217b2c2c867df1

Chuwei He   commited 2025-08-07 10:11:16 +09:00
18a67028d2
Merge "Move #nativeWaitForService into CommonConnectivityJni" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-08-06 11:12:41 -07:00
2e342c6d9b
Move #nativeWaitForService into CommonConnectivityJni
AServiceManager_waitForService sytem APIs currently only callable
via dlsym(): b/376759605. When built with sdk_version current,
the NDK stubs for "sdk" variants only include NDK APIs,
excluding #systemapi APIs.

Flag: EXEMPT Mechanical refactors
Test: atest ServiceManagerWrapperIntegrationTest
Change-Id: I48f690d771c7905e79e463617ded772f753cc854

Mark Chien   authored and   Patrick Rohr   commited 2025-08-06 10:44:39 -07:00
f250ade6fa
Merge "Use reported satellite suspended and roaming state" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-06 00:29:17 -07:00
2d94e180e7
Merge "Include NET_CAPABILITY_NOT_VCN_MANAGED for tethering local network agent" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-08-05 23:07:49 -07:00
1986dec249
Include NET_CAPABILITY_NOT_VCN_MANAGED for tethering local network agent
Currently, NET_CAPABILITY_NOT_VCN_MANAGED is implicited added for
NetworkRequest built by normal apps.
However, the tethering network agent doesn't have this capability,
which makes the agent being exposed to VcnManager and cannot be
seen by normal apps.

Add NET_CAPABILITY_NOT_VCN_MANAGED to tethering NetworkAgent. Include
NET_CAPABILITY_NOT_VCN_MANAGED in local network capabilities for
metrics and API utilities to ensure correct evaluation of local
network connectivity. Update unit tests to reflect the new capability.

Flag: EXEMPT bug fix
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSSatisfiedByLocalNetworkMetricsTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatisfiedByLocalNetworkMetricsTest \
      --update-device
Test: manual generate request by CTS and statsd_testdrive -e 10247
Bug: 428098173
Change-Id: Ifa9ce0827abd22d887a0e8a2ab6f4d7391b2b8ed

Junyu Lai   commited 2025-08-06 11:24:33 +08:00
fbf102a88b
Use reported satellite suspended and roaming state
Bug: 431296970
Test: TH
Flag: EXEMPT mainline
Change-Id: I4d828bad6419aa2d12bff6f1855314c0060af3f7

Motomu Utsumi   commited 2025-08-06 09:53:30 +09:00
f9065b8898
Use FakeSettingsProvider callbacks to simplify CS tests.
Because FakeSettingsProvider and other test infrastructure did
not support settings observers, the tests called internal
ConnectivityService methods to cause the settings to be re-read.
Now that FakeSettingsProvider supports callbacks, use
ContentResolverWithFakeSettingsProvider in the CS tests and just
use the callbacks.

Bug: 397521796
Flag: TEST_ONLY
Test: test-only change
Change-Id: I26d8e98706fec99aa423721bf1474af2f9b60099

Lorenzo Colitti   commited 2025-08-05 18:02:02 +09:00
6e3afc7dc6
Merge "Add test for ingress to VPN address filtering" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-03 19:36:25 -07:00
a26cea6c1e
Merge "Add logging for onPermissionsChanged latency." into main
Hao Liu   authored and   Android (Google) Code Review   commited 2025-07-31 06:47:43 -07:00
85415edca0
Add logging for onPermissionsChanged latency.
Flag: com.android.tethering.mainline.beta.lnp_developer_opt_in
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.PermissionMonitorTest
Bug: 424558169

Change-Id: Ifb621149130212a2903a7c31eebd4126e7d9924a

Hao Liu   commited 2025-07-31 03:02:08 +00:00
55614983a6
Fix UnfinishedStubbingException when running testAutomotiveEthernetAllowedUids
Mocking the PackageManager while ConnectivityService is running
could throw an UnfinishedStubbingException. This change splits
the test into two distinct tests that don't need to change the
mocking value for PackageManager during testing.

Fix: 433600031
Test: atest ConnectivityServiceTest
Flag: TEST_ONLY
Change-Id: Ibcff2082d1e50e89c272573b4c719a7325c959fd

Paul Hu   commited 2025-07-30 08:36:26 +00:00
e4e65d7b48
Add test for ingress to VPN address filtering
aosp/3201971 and aosp/3208090 updated ConnectivityService not to add
filtering rule for TYPE_VPN_LEGACY and TYPE_VPN_OEM to fix the issue in
b/352424251
This CL adds tests to veirfy the fix.

Test: NetworkAgentTest
Bug: 364982471
Flag: EXEMPT test only change
Change-Id: Ic3c108b9018f2137c1ae870a88c06e03518874c6

Motomu Utsumi   commited 2025-07-30 16:29:42 +09:00
1cda4503f2
Merge "Add proto to store network configuration" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-25 16:48:31 -07:00
3e3e18b2f1
Merge "Notify offload engine with discovery service information" into main
Paul Hu   authored and   Android (Google) Code Review   commited 2025-07-25 01:48:41 -07:00
f98e4c2f7b
Merge "Do not restart after updateConfiguration in NCM mode" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-24 16:43:21 -07:00
8cef9e556e
Merge "Create CommonConnectivityJni to share between modules" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-07-24 09:56:39 -07:00
0e5defc1e9