Disable non-thread local network matching

Currently, apps targeting V can see thread local network.

This change introduces a mechanism to make existing
apps unable to see non-thread local networks to ensure minimal
impact on existing devices and applications while adopting this
behavior. Apps targeting B+ Sdk and run on V+ devices can see
non-thread local networks.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalAgentTests \
      --update-device
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server --update-device
      (on next/trunk_staging release config)
Bug: 349487600
Change-Id: I6aa43cebc20a9017c2d8a8a90ebb1d53040a27bb
This commit is contained in:
Junyu Lai 2025-03-19 07:30:11 +08:00
commit 0b806fd931

View file

@ -148,6 +148,17 @@ public final class ConnectivityCompatChanges {
@EnabledAfter(targetSdkVersion = Build.VERSION_CODES.CUR_DEVELOPMENT)
public static final long RESTRICT_LOCAL_NETWORK = 365139289L;
/**
* Enable match non-threads local networks.
*
* Apps targeting a release after V can have NetworkRequests matches non-thread local networks.
*
* @hide
*/
@ChangeId
@EnabledAfter(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM)
public static final long ENABLE_MATCH_NON_THREAD_LOCAL_NETWORKS = 349487600L;
private ConnectivityCompatChanges() {
}
}