Merge "Trigger reevaluation of all requests when mobile data state changes" am: 5a2abf1341

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1692660

Change-Id: I51d0b068eac2a375d09b2ee146db0db2ac755406
This commit is contained in:
Treehugger Robot
2021-05-01 01:47:56 +00:00
committed by Automerger Merge Worker
2 changed files with 17 additions and 1 deletions

View File

@@ -396,6 +396,15 @@ public class Vcn extends Handler {
continue; continue;
} }
// This should never happen, by virtue of checking for the above check for
// pre-existing VcnGatewayConnections that satisfy a given request, but if state
// that affects the satsifying of requests changes, this is theoretically possible.
if (mVcnGatewayConnections.containsKey(gatewayConnectionConfig)) {
Slog.wtf(getLogTag(), "Attempted to bring up VcnGatewayConnection for config "
+ "with existing VcnGatewayConnection");
return;
}
final VcnGatewayConnection vcnGatewayConnection = final VcnGatewayConnection vcnGatewayConnection =
mDeps.newVcnGatewayConnection( mDeps.newVcnGatewayConnection(
mVcnContext, mVcnContext,
@@ -467,6 +476,9 @@ public class Vcn extends Handler {
} }
} }
} }
// Trigger re-evaluation of all requests; mobile data state impacts supported caps.
mVcnContext.getVcnNetworkProvider().resendAllRequests(mRequestListener);
} }
} }

View File

@@ -388,8 +388,9 @@ public class VcnTest {
final ContentObserver contentObserver = captor.getValue(); final ContentObserver contentObserver = captor.getValue();
// Start VcnGatewayConnections // Start VcnGatewayConnections
final NetworkRequestListener requestListener = verifyAndGetRequestListener();
mVcn.setMobileDataEnabled(startingToggleState); mVcn.setMobileDataEnabled(startingToggleState);
triggerVcnRequestListeners(verifyAndGetRequestListener()); triggerVcnRequestListeners(requestListener);
final Map<VcnGatewayConnectionConfig, VcnGatewayConnection> gateways = final Map<VcnGatewayConnectionConfig, VcnGatewayConnection> gateways =
mVcn.getVcnGatewayConnectionConfigMap(); mVcn.getVcnGatewayConnectionConfigMap();
@@ -411,6 +412,9 @@ public class VcnTest {
} }
} }
if (startingToggleState != endingToggleState) {
verify(mVcnNetworkProvider).resendAllRequests(requestListener);
}
assertEquals(endingToggleState, mVcn.isMobileDataEnabled()); assertEquals(endingToggleState, mVcn.isMobileDataEnabled());
} }