Clarify network validation code.

Clarify the code around loading and validating network capabilities and
transports.

Bug: 248307450
Test: N/A
Change-Id: I2b1daab240d2f812207d5296418ee66445dca045
This commit is contained in:
Kweku Adams
2022-10-03 19:39:15 +00:00
parent 677d18848e
commit 89d3afd576

View File

@@ -1095,6 +1095,8 @@ public final class JobStore {
}
if ((netCapabilitiesIntArray != null) && (netTransportTypesIntArray != null)) {
// S+ format. No capability or transport validation since the values should be in
// line with what's defined in the Connectivity mainline module.
final NetworkRequest.Builder builder = new NetworkRequest.Builder()
.clearCapabilities();
@@ -1111,6 +1113,7 @@ public final class JobStore {
}
jobBuilder.setRequiredNetwork(builder.build());
} else if (netCapabilitiesLong != null && netTransportTypesLong != null) {
// Format used on R- builds. Drop any unexpected capabilities and transports.
final NetworkRequest.Builder builder = new NetworkRequest.Builder()
.clearCapabilities();
final int maxNetCapabilityInR = NET_CAPABILITY_TEMPORARILY_NOT_METERED;