summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorChalard Jean <jchalard@google.com>2021-03-19 05:39:40 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-03-19 05:39:40 +0000
commit93a3f18a402dff7c1b4723a99b6a48577e02bc0f (patch)
treea219c5c45ea74929b173890b33ebcf5e90b0c766 /packages
parent47157e77113e9362e9a511c9c0be99639cc5139a (diff)
parentb5dbd7f46da55029d72ff11ece039ae00514b7ef (diff)
Merge "[NS02] Mix in validation of the score"
Diffstat (limited to 'packages')
-rw-r--r--packages/Connectivity/framework/src/android/net/NetworkScore.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/packages/Connectivity/framework/src/android/net/NetworkScore.java b/packages/Connectivity/framework/src/android/net/NetworkScore.java
index f47801002296..e640737168a3 100644
--- a/packages/Connectivity/framework/src/android/net/NetworkScore.java
+++ b/packages/Connectivity/framework/src/android/net/NetworkScore.java
@@ -33,13 +33,21 @@ public final class NetworkScore implements Parcelable {
// a migration.
private final int mLegacyInt;
+ // Agent-managed policies
+ // TODO : add them here, starting from 1
+
+ // Bitmask of all the policies applied to this score.
+ private final long mPolicies;
+
/** @hide */
- NetworkScore(final int legacyInt) {
- this.mLegacyInt = legacyInt;
+ NetworkScore(final int legacyInt, final long policies) {
+ mLegacyInt = legacyInt;
+ mPolicies = policies;
}
private NetworkScore(@NonNull final Parcel in) {
mLegacyInt = in.readInt();
+ mPolicies = in.readLong();
}
public int getLegacyInt() {
@@ -54,6 +62,7 @@ public final class NetworkScore implements Parcelable {
@Override
public void writeToParcel(@NonNull final Parcel dest, final int flags) {
dest.writeInt(mLegacyInt);
+ dest.writeLong(mPolicies);
}
@Override
@@ -79,6 +88,7 @@ public final class NetworkScore implements Parcelable {
* A builder for NetworkScore.
*/
public static final class Builder {
+ private static final long POLICY_NONE = 0L;
private static final int INVALID_LEGACY_INT = Integer.MIN_VALUE;
private int mLegacyInt = INVALID_LEGACY_INT;
@@ -102,7 +112,7 @@ public final class NetworkScore implements Parcelable {
*/
@NonNull
public NetworkScore build() {
- return new NetworkScore(mLegacyInt);
+ return new NetworkScore(mLegacyInt, POLICY_NONE);
}
}
}