Commit graph android_packages_modules_Co.../tests
Message SHA1
Use string for CREATE_APP_SPECIFIC_NETWORK permission
This allows using the permission in 25Q4 before it becomes a
public API in 26Q2.

Flag: android.net.platform.flags.create_app_specific_network_permission
Test: TH
Bug: 435313135
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:60f7743f773b05a98e651c953631e93957291bf5
Merged-In: I8d336a588eddf9a027079e208b2b96bb6c163e86
Change-Id: I8d336a588eddf9a027079e208b2b96bb6c163e86

Motomu Utsumi   authored and   Android Build Coastguard Worker   commited 2025-09-30 03:56:13 -07:00
c4fea9d31c
Merge "Bump the min sdk of Tethering" into main
Pedro Loureiro   authored and   Android (Google) Code Review   commited 2025-09-12 15:01:57 -07:00
b528f1634b
Merge changes from topics "redact-netcaps", "redact-specifier", "specifier-metrics" into main
* changes:
  [connectivity] rename createWithLocationInfoSanitizedIfNecessaryWhenParceled
  [connectivity] use new redact(RedactionType) for output NetworkSpecifier
  [connectivity] move redaction to createWithLocationInfoSanitizedIfNecessaryWhenParceled
  [connectivity] add permission check on requested NetworkSpecifier
  [connectivity] redact NeworkSpecifier in NetworkCapabilities
  [connectivity] add NetworkCapabilities.RedactionHelper
  [Thread] add REDACT_FOR_THREAD_NETWORK_PRIVILEGED

Kangping Dong   authored and   Android (Google) Code Review   commited 2025-09-12 13:26:22 -07:00
a133acc106
Bump the min sdk of Tethering
This is required because we are bumping the min sdk of NetworkStack
which this depends on.

Test: build locally + aapt2 dump badging

Bug: 444168252

Flag: build.RELEASE_DEPRECATE_MAINLINE_R_SUPPORT
Change-Id: Idbff03cdcca9955a4759c19866895f755abedaaf

Pedro Loureiro   commited 2025-09-12 18:34:18 +00:00
48eb28f7ee
KernelUtils.h: isAtLeastKernelVersion(x,y,z) - default 'z' to 0
This seems to be the most common usecase.

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

Maciej Żenczykowski   commited 2025-09-12 10:14:12 -07:00
ee24054e2b
[connectivity] rename createWithLocationInfoSanitizedIfNecessaryWhenParceled
It's already redacting more sensitive information other than just
location info.

This is a follow up CL for https://googleplex-android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/34224156/comment/98b93666_a824d7bc/

Bug: 374037595
Flag: EXEMPT PURE_REFACTOR
Change-Id: I6524c4f9ee9b5273e4ab421f54ae3115dea2cc8a

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
6fd0624452
[connectivity] use new redact(RedactionType) for output NetworkSpecifier
This commit replace the existing usage of NetworkSpecifier#redact() to
the new NetworkSpecifier#redact(RedactionType) API.

This doesn't change the existing behavior because redact() is still
called for NetworkSpecifiers which doesn't oevrride
getApplicableRedactions() method.

Bug: 374037595
Flag: NONE can't use simply flag guarding because the code needs to
      maintain compatibility across different mainline and platform versions

Change-Id: I30d7257b8e5880218b315ade60d2d77fed1f89fb

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
997c5651d0
[connectivity] move redaction to createWithLocationInfoSanitizedIfNecessaryWhenParceled
This commit has almost no behavior changes, because:

1. usage of networkCapabilitiesRestrictedForCallerPermissions is
   either wrapped by
   createWithLocationInfoSanitizedIfNecessaryWhenParceled or
   getNetworkCapabilitiesInternal.
2. All usages of getNetworkCapabilitiesInternal is either wrapped by
   createWithLocationInfoSanitizedIfNecessaryWhenParceled or the
   redacted info in the return value is not used by its caller
3. The only exception for getNetworkCapabilitiesInternal is that it is
   used in simulateDataStall() which checks the underlying network but
   underlying network in the NetworkCapabilities can be redacted by
   networkCapabilitiesRestrictedForCallerPermissions. Removing redaction
   from getNetworkCapabilitiesInternal() will loose the current permission
   requirement but this is wanted as the existing implementation has
   stricter permission requirements than the API signature declares and
   this CL fixes it

Bug: 374037595
Flag: NONE no behavior change but only bug fix
Change-Id: I80491d26ed7d11cb3fe1850ef7be9ae7600d5dd5

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
b9c6df36de
[connectivity] add permission check on requested NetworkSpecifier
This commit adds permission check for new NetworkSpecifier subclasses
which override the new redact(long) method. It throws SecurityException
if the caller doesn't hold the permissions to use the sensitive info in
the NetworkSpecifier class.

Bug: 374037595
Flag: NONE can't use simply flag guarding because the code needs to
maintain compatibility across different mainline and platform versions

Change-Id: Ife8efab3e99adf41d7522fedbde3b4ec80045c77

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
d2c9202a9b
[connectivity] redact NeworkSpecifier in NetworkCapabilities
The existing NetworkCapabilities class redacts only TransportInfo and
leaves NetworkSpecifier as it is. This is counter-intuitive and the
specifier should be redacted along with TransportInfo as well.

Bug 374037595
Flag: NONE this has no behavior change for all existing
      NetworkSpecifier subclasses because they are not overriding the
      new NetworkSpecifier redaction methods

Change-Id: I73c880add1604afc8b56190647305a54e89e8e53

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
5fd72324ce
[connectivity] add NetworkCapabilities.RedactionHelper
Add a new hidden inner class NetworkCapabilities.RedactionHelper for
accessing conditionally available NetworkSpecifier methods via
reflection.

Reflection is necessary because NetworkSpecifier is platform code. So
it's possible for a mainline update to define a
getApplicableRedactions() or redact(long) method in a subclass of
NetworkSpecifier (e.g., EthernetNetworkSpecifier), and then to run
that mainline module on an Android release where the
NetworkSpecifier base class does not have those methods. On such a
device, ConnectivityService must still call those methods if they
exist, otherwise it would fail to redact information that needs to
be redacted. Another way to do this would be for ConnectivityService
to just call the method and catch NoSuchMethodError, but this code
runs fairly often and constructing exceptions is expensive.

This class is not used in this CL but will be used for NetworkSpecifier
redaction in ag/34242202 and ag/34242203

Bug 374037595
Flag: NONE new code nerver used

Change-Id: I8f88c6bb105ebf8d485e18cd214bebf2abe67e63

Kangping Dong   commited 2025-09-12 15:05:55 +08:00
89c94195a0
CCT VPN bypass for Android U and below
Implements logic to allow CCT to bypass VPN on Android U (API 34) and
older. On these Android versions, netd's VPN bypass APIs
(networkSetProtectAllow/Deny) operate globally.

Test: TH
Flag: NONE legacy flag protected
Change-Id: I3650c3823d65504046d74cd60485d9cc890937d8

Yuyang Huang   commited 2025-09-12 12:00:35 +09:00
7daab8cc60
Merge "Fix VPN bypass by updating VPN filter" into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-09-10 21:18:30 -07:00
aa849c4158
Fix VPN bypass by updating VPN filter
This commit addresses an issue where the VPN bypass feature was not
functioning correctly. The VPN filter has been updated to properly
handle bypass rules, ensuring that designated traffic can now bypass the
VPN as intended.

Test: TH, manual
Flag: EXEMPT guarded by default-off legacy flag
Change-Id: Ie6073db4e23a3132042da21c25b696fa3abc4c91

Lorenzo Colitti   authored and   Yuyang Huang   commited 2025-09-11 11:50:05 +09:00
e4f5f85647
Merge "Add util method to convert StaticIpConfiguration from proto" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-09 20:20:50 -07:00
32d4c35ae8
Merge "Add util method to convert StaticIpConfiguration to proto" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-09 20:20:06 -07:00
a599e8670e
Add util method to convert StaticIpConfiguration from proto
This patch adds util methods to convert StaticIpConfiguration from its
proto equivalent, and also adds unit tests to test the conversion.

Test: atest ConnectivityCoverageTests
Bug: 397536853
Flag: EXEMPT mainline

Change-Id: Iba4955efac3b854684f0d0f32b6d5667cebdc265

Chuwei He   commited 2025-09-10 10:34:13 +09:00
c77b880d86
Add util method to convert StaticIpConfiguration to proto
This patch adds util methods to convert StaticIpConfiguration to its
proto equivalent, and also adds unit tests to test the conversion.

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

Chuwei He   commited 2025-09-10 10:34:00 +09:00
014ae496d1
Merge "Remove service-side TrafficStats rate limit cache" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-09-08 01:20:02 -07:00
fe61faa220
Merge "Add conversion util methods for EthernetPortSelector" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-07 18:37:16 -07:00
54b93bb3c5
Merge "Add conversion util methods for LinkAddress" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-07 18:36:37 -07:00
41f97eedb2
Merge "Add conversion util methods for MeteredOverride" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-07 18:36:14 -07:00
1c67fe0789
Merge "Add CTS to validate socket FwMark value" into main
Sewook Seo   authored and   Android (Google) Code Review   commited 2025-09-06 07:11:12 -07:00
7b5ec3e68b
Fix setDelegateUid unit test.
The assertion that the app was removed from the list was due to
the fact that when adding the same UID twice, the code first
removes it and then re-adds it.

Add a bit more test coverage.

Test: test-only change
Flag: EXEMPT TEST_ONLY
Change-Id: I1eda5be93668ebda7fe2049a2d1ace4e744948e7

Lorenzo Colitti   commited 2025-09-05 19:10:51 +09:00
fb3a754f83
Merge "Add a simple unit test for setDelegateUid." into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-09-05 01:43:41 -07:00
f8741c9611
Add CTS to validate socket FwMark value
Bug: 373280981
Bug: 331139818
Flag: EXEMPT test code
Test: atest android.net.cts.NetworkAgentTest
NO_IFTTT=no change required
Change-Id: I32da9f0c703f4572cd28f85111f199aad3d83541

Sewook Seo   commited 2025-09-04 23:44:51 -07:00
8251949339
Add a simple unit test for setDelegateUid.
This is currently very simple, but should be easy to extend.

Test: test-only change
Flag: EXEMPT TEST_ONLY
Change-Id: Ibcb286dcef0b159f01faf3dd0a17c977a7d60a52

Lorenzo Colitti   authored and   Yuyang Huang   commited 2025-09-05 15:13:23 +09:00
cb91fe2c4a
Add conversion util methods for EthernetPortSelector
This patch adds util methods to convert EthernetPortSelector to and from
its proto equivalent, and also adds unit tests to test the conversion.

Test: atest ConnectivityCoverageTests
Bug: 397536853
Flag: EXEMPT mainline

Change-Id: I0603c7a4004a83448c3d6ec4c1d0c6149708fd9d

Chuwei He   commited 2025-09-04 14:10:04 +09:00
c0293a238b
Add conversion util methods for LinkAddress
This patch adds util methods to convert LinkAddress to and from
its proto equivalent, and also adds unit tests to test the conversion.

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

Chuwei He   commited 2025-09-04 14:09:23 +09:00
a9454a1b48
Add conversion util methods for MeteredOverride
This patch adds util methods to convert MeteredOverride to and from
its proto equivalent, and also adds unit tests to test the conversion.

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

Chuwei He   commited 2025-09-04 14:09:11 +09:00
b5ad6f83b2
Merge "Revert "Fix flake in ConnectivityDiagnosticsManager"" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-09-03 03:42:30 -07:00
01a9a57f0b
Revert "Fix flake in ConnectivityDiagnosticsManager"
This reverts commit 3a6edd4e01.

Reason for revert: b/436710938,test gets nc before network is validated especially if the “mobile data always on” is disabled 

Change-Id: Ie58d2a7eb707fd0baf5217004d01d3e56fad5449

Motomu Utsumi   authored and   Android (Google) Code Review   commited 2025-09-03 01:04:16 -07:00
f41a551ecd
Merge changes from topic "routecontrollerchangeforislocal" into main
* changes:
  Migrate NetdUtils from networkAddRoute to networkAddRouteParcel.
  Passing isLocalRoute to netd add,remove and update route.

Sarup Dalwani   authored and   Android (Google) Code Review   commited 2025-08-29 08:01:18 -07:00
bc8c8c040e
Merge "Rename getAllInterfaceOffloadServiceInfos to notifyOffloadStart" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-28 21:22:59 -07:00
94c93cbbe4
Migrate NetdUtils from networkAddRoute to networkAddRouteParcel.
This will allow us to deprecate networkAddRoute.

Bug:412629841
Test: atest TetheringTests
Flag: EXEMPT Using device config kill-switch
Change-Id: I20e988f760b8ad22b51effdc1f0e204763c6e240

Sarup Dalwani   commited 2025-08-28 15:28:48 +00:00
98e5827ccc
Passing isLocalRoute to netd add,remove and update route.
ConnectivityService would be centralized location for deciding local
network so for this effort passing isLocalRoute parameter to
routecontroller in netd for route addition, removal and modification.

Bug: 394308861
Test: Manually tested.
Test: atest ConnectivityCoverageTests
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivityservice.CSLocalRouteTest
Test: atest netd_integration_test
Flag: EXEMPT Using device config kill-switch
Change-Id: I9f11882665375bba10fa369c2e25f374b5e63661

Sarup Dalwani   commited 2025-08-28 14:59:26 +00:00
169a584691
Merge "Provide offload service information update from DiscoveryManager" into main
Paul Hu   authored and   Android (Google) Code Review   commited 2025-08-28 07:37:56 -07:00
9111ff26d4
Merge "jni tests: set min_sdk_version=33" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-08-27 15:01:01 -07:00
4a4c1c4485
Merge "Mock QuiConnectionCloser in ConnectivityServiceTest" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-27 10:05:46 -07:00
0705d728b0
Mock QuiConnectionCloser in ConnectivityServiceTest
ConnectivityServiceTest can not start QuicConnectionCloser and was
getting the following error.
The interaction between ConnectivityService and QuicConnectionCloser is
already covered by CSDestroySocketTest.
```
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: [SkDestroyListener] ERROR Failed to create rtnetlink socket: socket failed: EACCES (Permission denied)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: android.system.ErrnoException: socket failed: EACCES (Permission denied)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at libcore.io.Linux.socket(Native Method)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at libcore.io.ForwardingOs.socket(ForwardingOs.java:821)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:402)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at libcore.io.ForwardingOs.socket(ForwardingOs.java:821)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.system.Os.socket(Os.java:834)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.net.connectivity.com.android.net.module.util.ip.NetlinkMonitor.createFd(NetlinkMonitor.java:127)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.net.connectivity.com.android.net.module.util.FdEventsReader.createAndRegisterFd(FdEventsReader.java:217)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.net.connectivity.com.android.net.module.util.FdEventsReader.start(FdEventsReader.java:111)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.net.connectivity.com.android.server.connectivity.QuicConnectionCloser$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.os.Handler.handleCallback(Handler.java:959)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.os.Handler.dispatchMessage(Handler.java:100)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.os.Looper.loopOnce(Looper.java:232)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.os.Looper.loop(Looper.java:317)
08-26 18:53:53.469 6243 11101 E QuicConnectionCloser: at android.os.HandlerThread.run(HandlerThread.java:85)
```

Bug: 311792075
Test: atest ConnectivityServiceTest
Flag: EXEMPT test only change
Change-Id: I8ae1033b2ea655ebc26300aac19ec4d8cbdc047d

Motomu Utsumi   commited 2025-08-27 01:17:10 -07:00
a74f8c7782
Merge "Skip testCallbacks when unrestricted interfaces are present" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-08-26 20:42:47 -07:00
41a8778165
Rename getAllInterfaceOffloadServiceInfos to notifyOffloadStart
This renaming is to align the DiscoveryManager design and reflect
its real usage.

Bug: 410734687
Test: atest ConnectivityCoverageTests NsdManagerTest
Flag: EXEMPT rename method only
Change-Id: I0d198aa0752ef51353e4164b612b6ff268ace16a

Paul Hu   commited 2025-08-27 02:26:14 +00:00
20556631d8
Provide offload service information update from DiscoveryManager
With this change, the OffloadEngine can receive updates when
offload service information changes from DiscoveryManager. This
allows the OffloadEngine to maintain offload services and to
adjust its behavior accordingly.

Bug: 410734687
Test: atest ConnectivityCoverageTests
Flag: com.android.tethering.mainline.beta.nsd_selective_mdns_response_offload
Change-Id: I6c6ba4e76b4a2a94cbfef37bec9d6f87357bec5f

Paul Hu   commited 2025-08-27 02:13:32 +00:00
f1ae69a950
Merge "Set min_sdk_version for FrameworksNetTests." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-26 16:34:00 -07:00
06fd2ba600
Skip testCallbacks when unrestricted interfaces are present
The old assumption check ran the test on devices with unrestricted
interfaces which were configured in the overlay. Apparently, this is
a common configuration on automotive devices.

There are likely other tests that are broken which need to be moved to
the new assumption check.

Test: TH
Flag: EXEMPT mainline
Change-Id: I504534920ea2c083a05bf217bec17a084a829184

Patrick Rohr   commited 2025-08-26 15:37:47 -07:00
2a8b4670a3
Set min_sdk_version for FrameworksNetTests.
This change specifies that FrameworksNetTests requires a minimum SDK version of 31.

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

Maciej Żenczykowski   commited 2025-08-26 12:26:45 -07:00
0078ef9d14
Set min_sdk_version for FrameworksNetSmokeTests.
This change sets the minimum SDK version for the FrameworksNetSmokeTests to 31.

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

Maciej Żenczykowski   commited 2025-08-26 12:25:02 -07:00
96edc9907c
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