diff --git a/framework/src/android/net/connectivity/ConnectivityCompatChanges.java b/framework/src/android/net/connectivity/ConnectivityCompatChanges.java index c3279306f9..8c8c36f5de 100644 --- a/framework/src/android/net/connectivity/ConnectivityCompatChanges.java +++ b/framework/src/android/net/connectivity/ConnectivityCompatChanges.java @@ -154,12 +154,12 @@ public final class ConnectivityCompatChanges { /** * Enable match non-threads local networks. * - * Apps targeting a release after V can have NetworkRequests matches non-thread local networks. + * Apps targeting a release after B can have NetworkRequests matches non-thread local networks. * * @hide */ @ChangeId - @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM) + @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.BAKLAVA) public static final long ENABLE_MATCH_NON_THREAD_LOCAL_NETWORKS = 349487600L; private ConnectivityCompatChanges() { diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java index 35efabdaef..25fbcd5789 100644 --- a/service/src/com/android/server/ConnectivityService.java +++ b/service/src/com/android/server/ConnectivityService.java @@ -3409,8 +3409,12 @@ public class ConnectivityService extends IConnectivityManager.Stub private void maybeDisableLocalNetworkMatching(NetworkCapabilities nc, int callingUid) { // If disabled, NetworkRequest cannot match non-thread local networks even if - // specified explicitly. Compat change is enabled by default on apps targeting B+. - // Agent should not be visible on U- even if it's rolled out. + // specified explicitly. Compat change is enabled by default on apps targeting sdk + // level 37. Agent should not be visible on platform sdk level 36- even if it's rolled out. + // Note that on V+, isChangeEnabled returns false for + // ENABLE_MATCH_NON_THREAD_LOCAL_NETWORKS even if the app is targeting higher SDK + // due to b/401088586. + // TODO: Update the gating logic once SDK int APIs are ready. nc.setMatchNonThreadLocalNetworks(mDeps.isAtLeastV() && mDeps.isChangeEnabled( ENABLE_MATCH_NON_THREAD_LOCAL_NETWORKS, callingUid)); if (mDeps.isChangeEnabled(ENABLE_MATCH_LOCAL_NETWORK, callingUid)) {