Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30db6d93 authored by Jeremy Joslin's avatar Jeremy Joslin Committed by android-build-merger
Browse files

Add a meteredHint to ScoredNetwork.

am: 85870d63

* commit '85870d63':
  Add a meteredHint to ScoredNetwork.
parents 9d076242 85870d63
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -25721,9 +25721,11 @@ package android.net {
  public class ScoredNetwork implements android.os.Parcelable {
  public class ScoredNetwork implements android.os.Parcelable {
    ctor public ScoredNetwork(android.net.NetworkKey, android.net.RssiCurve);
    ctor public ScoredNetwork(android.net.NetworkKey, android.net.RssiCurve);
    ctor public ScoredNetwork(android.net.NetworkKey, android.net.RssiCurve, boolean);
    method public int describeContents();
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.ScoredNetwork> CREATOR;
    field public static final android.os.Parcelable.Creator<android.net.ScoredNetwork> CREATOR;
    field public final boolean meteredHint;
    field public final android.net.NetworkKey networkKey;
    field public final android.net.NetworkKey networkKey;
    field public final android.net.RssiCurve rssiCurve;
    field public final android.net.RssiCurve rssiCurve;
  }
  }
+36 −4
Original line number Original line Diff line number Diff line
@@ -42,6 +42,16 @@ public class ScoredNetwork implements Parcelable {
     */
     */
    public final RssiCurve rssiCurve;
    public final RssiCurve rssiCurve;


    /**
     * A boolean value that indicates whether or not the network is believed to be metered.
     *
     * <p>A network can be classified as metered if the user would be
     * sensitive to heavy data usage on that connection due to monetary costs,
     * data limitations or battery/performance issues. A typical example would
     * be a wifi connection where the user would be charged for usage.
     */
    public final boolean meteredHint;

    /**
    /**
     * Construct a new {@link ScoredNetwork}.
     * Construct a new {@link ScoredNetwork}.
     *
     *
@@ -54,8 +64,26 @@ public class ScoredNetwork implements Parcelable {
     *     the scorer may choose to issue an out-of-band update at any time.
     *     the scorer may choose to issue an out-of-band update at any time.
     */
     */
    public ScoredNetwork(NetworkKey networkKey, RssiCurve rssiCurve) {
    public ScoredNetwork(NetworkKey networkKey, RssiCurve rssiCurve) {
        this(networkKey, rssiCurve, false /* meteredHint */);
    }

    /**
     * Construct a new {@link ScoredNetwork}.
     *
     * @param networkKey the {@link NetworkKey} uniquely identifying this network.
     * @param rssiCurve the {@link RssiCurve} representing the scores for this network based on the
     *     RSSI. This field is optional, and may be skipped to represent a network which the scorer
     *     has opted not to score at this time. Passing a null value here is strongly preferred to
     *     not returning any {@link ScoredNetwork} for a given {@link NetworkKey} because it
     *     indicates to the system not to request scores for this network in the future, although
     *     the scorer may choose to issue an out-of-band update at any time.
     * @param meteredHint A boolean value indicating whether or not the network is believed to be
     *     metered.
     */
    public ScoredNetwork(NetworkKey networkKey, RssiCurve rssiCurve, boolean meteredHint) {
        this.networkKey = networkKey;
        this.networkKey = networkKey;
        this.rssiCurve = rssiCurve;
        this.rssiCurve = rssiCurve;
        this.meteredHint = meteredHint;
    }
    }


    private ScoredNetwork(Parcel in) {
    private ScoredNetwork(Parcel in) {
@@ -65,6 +93,7 @@ public class ScoredNetwork implements Parcelable {
        } else {
        } else {
            rssiCurve = null;
            rssiCurve = null;
        }
        }
        meteredHint = in.readByte() != 0;
    }
    }


    @Override
    @Override
@@ -81,6 +110,7 @@ public class ScoredNetwork implements Parcelable {
        } else {
        } else {
            out.writeByte((byte) 0);
            out.writeByte((byte) 0);
        }
        }
        out.writeByte((byte) (meteredHint ? 1 : 0));
    }
    }


    @Override
    @Override
@@ -90,18 +120,20 @@ public class ScoredNetwork implements Parcelable {


        ScoredNetwork that = (ScoredNetwork) o;
        ScoredNetwork that = (ScoredNetwork) o;


        return Objects.equals(networkKey, that.networkKey) &&
        return Objects.equals(networkKey, that.networkKey)
                Objects.equals(rssiCurve, that.rssiCurve);
            && Objects.equals(rssiCurve, that.rssiCurve)
            && Objects.equals(meteredHint, that.meteredHint);
    }
    }


    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(networkKey, rssiCurve);
        return Objects.hash(networkKey, rssiCurve, meteredHint);
    }
    }


    @Override
    @Override
    public String toString() {
    public String toString() {
        return "ScoredNetwork[key=" + networkKey + ",score=" + rssiCurve + "]";
        return "ScoredNetwork[key=" + networkKey + ",score=" + rssiCurve
            + ",meteredHint=" + meteredHint + "]";
    }
    }


    public static final Parcelable.Creator<ScoredNetwork> CREATOR =
    public static final Parcelable.Creator<ScoredNetwork> CREATOR =