Merge "[NS02] Mix in validation of the score" am: b68825591b am: f6ad9e71b2 am: 37e8ecdb9a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556100 Change-Id: I4a622efe89f7d116751d0243ba29441ef76e997a
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user