Set TRANSPORT_PRIMARY for VCN NetworkOffers and NetworkAgents
This change sets TRANSPORT_PRIMARY for all NetworkScore objects passed to ConnectivityService by the VCN. Without this patch, a VCN in safe mode will never get any NetworkRequests, since the new Policy-based NetworkRanker always prioritizes a existing satisfier of a network, regardless of score. However, a higher-priority policy check ensures that a TRANSPORT_PRIMARY request is used if it exists. This changes the VCN to utilize that functionality. Bug: 194122634 Test: atest FrameworksVcnTests Change-Id: I3a298a6c4c594c6e224f3f05764614802c00e9b0
This commit is contained in:
@@ -599,7 +599,12 @@ public class Vcn extends Handler {
|
|||||||
/** Retrieves the network score for a VCN Network */
|
/** Retrieves the network score for a VCN Network */
|
||||||
// Package visibility for use in VcnGatewayConnection and VcnNetworkProvider
|
// Package visibility for use in VcnGatewayConnection and VcnNetworkProvider
|
||||||
static NetworkScore getNetworkScore() {
|
static NetworkScore getNetworkScore() {
|
||||||
return new NetworkScore.Builder().setLegacyInt(VCN_LEGACY_SCORE_INT).build();
|
// TODO(b/193687515): Stop setting TRANSPORT_PRIMARY, define a TRANSPORT_VCN, and set in
|
||||||
|
// NetworkOffer/NetworkAgent.
|
||||||
|
return new NetworkScore.Builder()
|
||||||
|
.setLegacyInt(VCN_LEGACY_SCORE_INT)
|
||||||
|
.setTransportPrimary(true)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Callback used for passing status signals from a VcnGatewayConnection to its managing Vcn. */
|
/** Callback used for passing status signals from a VcnGatewayConnection to its managing Vcn. */
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ public class VcnNetworkProviderTest {
|
|||||||
eq(mVcnNetworkProvider),
|
eq(mVcnNetworkProvider),
|
||||||
argThat(
|
argThat(
|
||||||
score ->
|
score ->
|
||||||
score.getLegacyInt()
|
score.getLegacyInt() == Vcn.getNetworkScore().getLegacyInt()
|
||||||
== Vcn.getNetworkScore().getLegacyInt()),
|
&& score.isTransportPrimary()),
|
||||||
any(),
|
any(),
|
||||||
any(),
|
any(),
|
||||||
cbCaptor.capture());
|
cbCaptor.capture());
|
||||||
|
|||||||
Reference in New Issue
Block a user