Merge "Update Mobile Data State on subscription changes." am: cb85575990
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1740514 Change-Id: I640b0f97b661a6595b32a3d11d1966b2af752815
This commit is contained in:
@@ -453,6 +453,10 @@ public class Vcn extends Handler {
|
|||||||
for (VcnGatewayConnection gatewayConnection : mVcnGatewayConnections.values()) {
|
for (VcnGatewayConnection gatewayConnection : mVcnGatewayConnections.values()) {
|
||||||
gatewayConnection.updateSubscriptionSnapshot(mLastSnapshot);
|
gatewayConnection.updateSubscriptionSnapshot(mLastSnapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the mobile data state after updating the subscription snapshot as a change in
|
||||||
|
// subIds for a subGroup may affect the mobile data state.
|
||||||
|
handleMobileDataToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMobileDataToggled() {
|
private void handleMobileDataToggled() {
|
||||||
|
|||||||
@@ -242,6 +242,27 @@ public class VcnTest {
|
|||||||
verifyUpdateSubscriptionSnapshotNotifiesGatewayConnections(VCN_STATUS_CODE_SAFE_MODE);
|
verifyUpdateSubscriptionSnapshotNotifiesGatewayConnections(VCN_STATUS_CODE_SAFE_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSubscriptionSnapshotUpdatesMobileDataState() {
|
||||||
|
final NetworkRequestListener requestListener = verifyAndGetRequestListener();
|
||||||
|
startVcnGatewayWithCapabilities(requestListener, TEST_CAPS[0]);
|
||||||
|
|
||||||
|
// Expect mobile data enabled from setUp()
|
||||||
|
assertTrue(mVcn.isMobileDataEnabled());
|
||||||
|
|
||||||
|
final TelephonySubscriptionSnapshot updatedSnapshot =
|
||||||
|
mock(TelephonySubscriptionSnapshot.class);
|
||||||
|
doReturn(TEST_SUB_IDS_IN_GROUP)
|
||||||
|
.when(updatedSnapshot)
|
||||||
|
.getAllSubIdsInGroup(eq(TEST_SUB_GROUP));
|
||||||
|
doReturn(false).when(mTelephonyManager).isDataEnabled();
|
||||||
|
|
||||||
|
mVcn.updateSubscriptionSnapshot(updatedSnapshot);
|
||||||
|
mTestLooper.dispatchAll();
|
||||||
|
|
||||||
|
assertFalse(mVcn.isMobileDataEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
private void triggerVcnRequestListeners(NetworkRequestListener requestListener) {
|
private void triggerVcnRequestListeners(NetworkRequestListener requestListener) {
|
||||||
for (final int[] caps : TEST_CAPS) {
|
for (final int[] caps : TEST_CAPS) {
|
||||||
startVcnGatewayWithCapabilities(requestListener, caps);
|
startVcnGatewayWithCapabilities(requestListener, caps);
|
||||||
|
|||||||
Reference in New Issue
Block a user