Merge "Allow VCN network to beat a physical cell in network ranking" into main

This commit is contained in:
Yan Yan 2025-06-17 11:09:54 -07:00 • committed by Android (Google) Code Review
commit 7b1145e6b4

View file

@ -89,11 +89,15 @@ public final class NetworkScore implements Parcelable {
// This network is exiting : it will likely disconnect in a few seconds.
/** @hide */
public static final int POLICY_EXITING = 3;
// This is a VCN network
// TODO: b/424266491 Remove this policy after adding a new NET_CAP to identify VCN
/** @hide */
public static final int POLICY_VCN = 4;
/** @hide */
public static final int MIN_AGENT_MANAGED_POLICY = POLICY_YIELD_TO_BAD_WIFI;
/** @hide */
public static final int MAX_AGENT_MANAGED_POLICY = POLICY_EXITING;
public static final int MAX_AGENT_MANAGED_POLICY = POLICY_VCN;
// Bitmask of all the policies applied to this score.
private final long mPolicies;
@ -193,6 +197,17 @@ public final class NetworkScore implements Parcelable {
return hasPolicy(POLICY_EXITING);
}
/**
* Whether this network is a VCN cell network.
*
* <p>When multiple cell networks are active, the device prefers the VCN cell network over a
* physical cell network.
*/
/** @hide */
public boolean isVcn() {
return hasPolicy(POLICY_VCN);
}
@Override
public String toString() {
return "Score(Policies : " + mPolicies + ")";
@ -319,6 +334,23 @@ public final class NetworkScore implements Parcelable {
return this;
}
/**
* Set for a VCN network.
*
* <p>When multiple cell networks are active, the device prefers the VCN cell network over a
* physical cell network.
*/
/** @hide */
@NonNull
public Builder setVcn(final boolean val) {
if (val) {
mPolicies |= (1L << POLICY_VCN);
} else {
mPolicies &= ~(1L << POLICY_VCN);
}
return this;
}
/**
* Set the keep-connected reason.
*