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
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 Żenczykowskicommited 2025-09-12 10:14:12 -07:00
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
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
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
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
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
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
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 Colittiauthored and Yuyang Huangcommited 2025-09-11 11:50:05 +09:00
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
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
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 Colitticommited 2025-09-05 19:10:51 +09:00
This is currently very simple, but should be easy to extend.
Test: test-only change
Flag: EXEMPT TEST_ONLY
Change-Id: Ibcb286dcef0b159f01faf3dd0a17c977a7d60a52
Lorenzo Colittiauthored and Yuyang Huangcommited 2025-09-05 15:13:23 +09:00
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
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
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
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 Utsumiauthored and Android (Google) Code Reviewcommited 2025-09-03 01:04:16 -07:00
This will allow us to deprecate networkAddRoute.
Bug:412629841
Test: atest TetheringTests
Flag: EXEMPT Using device config kill-switch
Change-Id: I20e988f760b8ad22b51effdc1f0e204763c6e240
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
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
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
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
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
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 Żenczykowskicommited 2025-08-26 12:26:45 -07:00
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 Żenczykowskicommited 2025-08-26 12:25:02 -07:00
The service-side TrafficStats rate limit cache is no longer needed as
client-side caching is now solely responsible for rate-limiting traffic
stats queries.
This commit removes:
- The `clearTrafficStatsRateLimitCaches` AIDL method.
- The service-side cache implementation, including member variables and
logic within `NetworkStatsService`.
- Related feature flags and constants used for the service-side cache.
- All unit tests specifically for the service-side cache.
This simplifies the overall traffic statistics caching architecture by
centralizing rate-limiting responsibility on the client side.
Flag: EXEMPT refactoring
Test: atest ConnectivityCoverageTests --test-filter '.*NetworkStats.*' --update-device
Test: atest ConnectivityCoverageTests --test-filter '.*TrafficStats.*' --update-device
Fix: 428098676
Fix: 428097311
Change-Id: I41cbb80a52f04dcf387c3352677a91cb692ffe73