Only apply the early network agent creation on B

...and if the feature is not killed.

For devices on V and below, this feature should be subject
to a rollout. That rollout should be done in mainline beta
if possible at all, meaning the flags can be defined later.

If beta isn't possible after all, a legacy rollout can happen
starting in M2025-06 too.

Test: manual
Change-Id: I941762bf759ce25b4bd1f908e971ceaf4f49f671
This commit is contained in:
Chalard Jean 2025-03-21 12:58:21 +09:00
commit 3d0e3121d9
3 changed files with 17 additions and 4 deletions

View file

@ -1473,6 +1473,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return SdkLevel.isAtLeastV();
}
public boolean isAtLeastB() {
return SdkLevel.isAtLeastB();
}
/**
* Get system properties to use in ConnectivityService.
*/
@ -1933,8 +1937,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mUseDeclaredMethodsForCallbacksEnabled =
mDeps.isFeatureNotChickenedOut(context,
ConnectivityFlags.USE_DECLARED_METHODS_FOR_CALLBACKS);
mQueueNetworkAgentEventsInSystemServer =
mDeps.isFeatureNotChickenedOut(context,
mQueueNetworkAgentEventsInSystemServer = mDeps.isAtLeastB()
&& mDeps.isFeatureNotChickenedOut(context,
ConnectivityFlags.QUEUE_NETWORK_AGENT_EVENTS_IN_SYSTEM_SERVER);
// registerUidFrozenStateChangedCallback is only available on U+
mQueueCallbacksForFrozenApps = mDeps.isAtLeastU()

View file

@ -2241,7 +2241,8 @@ public class ConnectivityServiceTest {
private static final int VERSION_T = 3;
private static final int VERSION_U = 4;
private static final int VERSION_V = 5;
private static final int VERSION_MAX = VERSION_V;
private static final int VERSION_B = 6;
private static final int VERSION_MAX = VERSION_B;
private int mSdkLevel = VERSION_UNMOCKED;
private void setBuildSdk(final int sdkLevel) {
@ -2270,6 +2271,12 @@ public class ConnectivityServiceTest {
: mSdkLevel >= VERSION_U;
}
@Override
public boolean isAtLeastB() {
return mSdkLevel == VERSION_UNMOCKED ? super.isAtLeastB()
: mSdkLevel >= VERSION_B;
}
@Override
public BpfNetMaps getBpfNetMaps(Context context, INetd netd,
InterfaceTracker interfaceTracker) {

View file

@ -112,7 +112,8 @@ internal const val VERSION_S = 2
internal const val VERSION_T = 3
internal const val VERSION_U = 4
internal const val VERSION_V = 5
internal const val VERSION_MAX = VERSION_V
internal const val VERSION_B = 6
internal const val VERSION_MAX = VERSION_B
internal const val CALLING_UID_UNMOCKED = Process.INVALID_UID
@ -388,6 +389,7 @@ open class CSTest {
override fun isAtLeastT() = if (isSdkUnmocked) super.isAtLeastT() else sdkLevel >= VERSION_T
override fun isAtLeastU() = if (isSdkUnmocked) super.isAtLeastU() else sdkLevel >= VERSION_U
override fun isAtLeastV() = if (isSdkUnmocked) super.isAtLeastV() else sdkLevel >= VERSION_V
override fun isAtLeastB() = if (isSdkUnmocked) super.isAtLeastB() else sdkLevel >= VERSION_B
private var callingUid = CALLING_UID_UNMOCKED