From 133d80662794b80269476dbdd75a580fb16c7382 Mon Sep 17 00:00:00 2001 From: Paul Hu Date: Thu, 13 Mar 2025 08:41:54 +0000 Subject: [PATCH] Force TETHER_ENABLE_SYNC_SM to be enabled by default on 25Q2+ Test: atest TetheringTests CtsTetheringTest Change-Id: Id63b4535aaebe90d5fa663ad4584cfd987c3b06b --- .../networkstack/tethering/TetheringConfiguration.java | 3 ++- .../tethering/TetheringConfigurationTest.java | 8 ++++++-- .../framework/com/android/net/module/util/SdkUtil.java | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java b/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java index 3c91a1baa3..5f0e5d08af 100644 --- a/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java +++ b/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java @@ -24,6 +24,7 @@ import static android.net.ConnectivityManager.TYPE_MOBILE_HIPRI; import static android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY; import static com.android.networkstack.apishim.ConstantsShim.KEY_CARRIER_SUPPORTS_TETHERING_BOOL; +import static com.android.net.module.util.SdkUtil.isAtLeast25Q2; import android.content.ContentResolver; import android.content.Context; @@ -395,7 +396,7 @@ public class TetheringConfiguration { * use the async state machine. */ public void readEnableSyncSM(final Context ctx) { - USE_SYNC_SM = mDeps.isFeatureNotChickenedOut(ctx, TETHER_ENABLE_SYNC_SM); + USE_SYNC_SM = isAtLeast25Q2() || mDeps.isFeatureNotChickenedOut(ctx, TETHER_ENABLE_SYNC_SM); } /** Does the dumping.*/ diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringConfigurationTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringConfigurationTest.java index 0159573acf..c4c7c9cca7 100644 --- a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringConfigurationTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringConfigurationTest.java @@ -63,6 +63,7 @@ import com.android.internal.util.test.BroadcastInterceptingContext; import com.android.internal.util.test.FakeSettingsProvider; import com.android.modules.utils.build.SdkLevel; import com.android.net.module.util.DeviceConfigUtils; +import com.android.net.module.util.SdkUtil; import com.android.net.module.util.SharedLog; import com.android.testutils.DevSdkIgnoreRule; import com.android.testutils.DevSdkIgnoreRule.IgnoreAfter; @@ -779,7 +780,10 @@ public class TetheringConfigurationTest { setTetherEnableSyncSMFlagEnabled(true); assertEnableSyncSM(true); - setTetherEnableSyncSMFlagEnabled(false); - assertEnableSyncSM(false); + // Feature is enabled by default after 25Q2 release. + if (!SdkUtil.isAtLeast25Q2()) { + setTetherEnableSyncSMFlagEnabled(false); + assertEnableSyncSM(false); + } } } diff --git a/staticlibs/framework/com/android/net/module/util/SdkUtil.java b/staticlibs/framework/com/android/net/module/util/SdkUtil.java index 5006ba989a..63558dd18c 100644 --- a/staticlibs/framework/com/android/net/module/util/SdkUtil.java +++ b/staticlibs/framework/com/android/net/module/util/SdkUtil.java @@ -16,7 +16,10 @@ package com.android.net.module.util; +import static android.os.Build.VERSION.SDK_INT; + import android.annotation.Nullable; +import android.os.Build; /** * Utilities to deal with multiple SDKs in a single mainline module. @@ -46,4 +49,9 @@ public class SdkUtil { this.value = value; } } + + /** Checks if the device is running on a release version of Android Baklava or newer */ + public static boolean isAtLeast25Q2() { + return SDK_INT >= 36 || (SDK_INT == 35 && "Baklava".equals(Build.VERSION.CODENAME)); + } }