Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default

Since the feature was fully rolled out via experiment without
regression, this commit replaced with a
kill switch.

Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:PrivateAddressCoordinatorTest
Fix: 312647670
Fix: 406955982
Change-Id: I18adcca45fa5f698adc80cea044d8006de097977
This commit is contained in:
Junyu Lai 2025-03-31 14:44:06 +08:00
commit db75d68801
3 changed files with 10 additions and 8 deletions

View file

@ -325,7 +325,8 @@ public final class PrivateAddressCoordinatorTest {
@Test
public void testStartedPrefixRange() throws Exception {
when(mDeps.isFeatureEnabled(TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION)).thenReturn(true);
when(mDeps.isFeatureNotChickenedOut(TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION))
.thenReturn(true);
startedPrefixBaseTest("192.168.0.0/16", 0);

View file

@ -538,8 +538,8 @@ public class TetheringTest {
public RoutingCoordinatorManager getRoutingCoordinator(
final Context context, SharedLog log) {
ConnectivityManager cm = context.getSystemService(ConnectivityManager.class);
when(mPrivateAddressCoordinatorDependencies.isFeatureEnabled(anyString()))
.thenReturn(false);
when(mPrivateAddressCoordinatorDependencies.isFeatureNotChickenedOut(anyString()))
.thenReturn(true);
RoutingCoordinatorService service = new RoutingCoordinatorService(
getINetd(context, log),
cm::getAllNetworks,

View file

@ -34,6 +34,7 @@ import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.os.RemoteException;
import android.provider.DeviceConfig;
import android.util.ArrayMap;
import androidx.annotation.Nullable;
@ -98,14 +99,14 @@ public class PrivateAddressCoordinator {
}
/**
* Check whether or not one specific experimental feature is enabled according to {@link
* DeviceConfigUtils}.
* Check whether one specific experimental feature in Tethering module
* from {@link DeviceConfig} is not disabled.
*
* @param featureName The feature's name to look up.
* @return true if this feature is enabled, or false if disabled.
*/
public boolean isFeatureEnabled(String featureName) {
return DeviceConfigUtils.isTetheringFeatureEnabled(mContext, featureName);
public boolean isFeatureNotChickenedOut(String featureName) {
return DeviceConfigUtils.isTetheringFeatureNotChickenedOut(mContext, featureName);
}
}
@ -259,7 +260,7 @@ public class PrivateAddressCoordinator {
}
private int getRandomPrefixIndex() {
if (!mDeps.isFeatureEnabled(TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION)) return 0;
if (!mDeps.isFeatureNotChickenedOut(TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION)) return 0;
final int random = getRandomInt() & 0xffffff;
// This is to select the starting prefix range (/8, /12, or /16) instead of the actual