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

Commit 9975186a authored by Antony Sargent's avatar Antony Sargent Committed by android-build-merger
Browse files

Merge "@Keep all the things in TestAccessPointBuilder" into oc-dr1-dev

am: 1e74fdb6

Change-Id: I0ccabd7441257ae1631ad8b362b64be37cf1a386
parents 05913746 1e74fdb6
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.net.NetworkInfo;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiInfo;
import android.os.Bundle;
import android.os.Bundle;
import android.support.annotation.Keep;


/**
/**
* Build and return a valid AccessPoint.
* Build and return a valid AccessPoint.
@@ -30,6 +31,7 @@ import android.os.Bundle;
* applications. AccessPoints were designed to only be populated by the mechanisms of scan results
* applications. AccessPoints were designed to only be populated by the mechanisms of scan results
* and wifi configurations.
* and wifi configurations.
*/
*/
@Keep
public class TestAccessPointBuilder {
public class TestAccessPointBuilder {
    // match the private values in WifiManager
    // match the private values in WifiManager
    private static final int MIN_RSSI = -100;
    private static final int MIN_RSSI = -100;
@@ -49,10 +51,12 @@ public class TestAccessPointBuilder {


    Context mContext;
    Context mContext;


    @Keep
    public TestAccessPointBuilder(Context context) {
    public TestAccessPointBuilder(Context context) {
        mContext = context;
        mContext = context;
    }
    }


    @Keep
    public AccessPoint build() {
    public AccessPoint build() {
        Bundle bundle = new Bundle();
        Bundle bundle = new Bundle();


@@ -77,6 +81,7 @@ public class TestAccessPointBuilder {
        return ap;
        return ap;
    }
    }


    @Keep
    public TestAccessPointBuilder setActive(boolean active) {
    public TestAccessPointBuilder setActive(boolean active) {
        if (active) {
        if (active) {
            mNetworkInfo = new NetworkInfo(
            mNetworkInfo = new NetworkInfo(
@@ -96,6 +101,7 @@ public class TestAccessPointBuilder {
     * <p>Side effect: if this AccessPoint was previously unreachable,
     * <p>Side effect: if this AccessPoint was previously unreachable,
     * setting the level will also make it reachable.
     * setting the level will also make it reachable.
     */
     */
    @Keep
    public TestAccessPointBuilder setLevel(int level) {
    public TestAccessPointBuilder setLevel(int level) {
        // Reversal of WifiManager.calculateSignalLevels
        // Reversal of WifiManager.calculateSignalLevels
        if (level == 0) {
        if (level == 0) {
@@ -110,11 +116,13 @@ public class TestAccessPointBuilder {
        return this;
        return this;
    }
    }


    @Keep
    public TestAccessPointBuilder setNetworkInfo(NetworkInfo info) {
    public TestAccessPointBuilder setNetworkInfo(NetworkInfo info) {
        mNetworkInfo = info;
        mNetworkInfo = info;
        return this;
        return this;
    }
    }


    @Keep
    public TestAccessPointBuilder setRssi(int rssi) {
    public TestAccessPointBuilder setRssi(int rssi) {
        mRssi = rssi;
        mRssi = rssi;
        return this;
        return this;
@@ -125,6 +133,7 @@ public class TestAccessPointBuilder {
    * Side effect: if the signal level was not previously set,
    * Side effect: if the signal level was not previously set,
    * making an AccessPoint reachable will set the signal to the minimum level.
    * making an AccessPoint reachable will set the signal to the minimum level.
    */
    */
    @Keep
    public TestAccessPointBuilder setReachable(boolean reachable) {
    public TestAccessPointBuilder setReachable(boolean reachable) {
        if (reachable) {
        if (reachable) {
            // only override the mRssi if it hasn't been set yet
            // only override the mRssi if it hasn't been set yet
@@ -137,6 +146,7 @@ public class TestAccessPointBuilder {
        return this;
        return this;
    }
    }


    @Keep
    public TestAccessPointBuilder setSaved(boolean saved){
    public TestAccessPointBuilder setSaved(boolean saved){
        if (saved) {
        if (saved) {
             mNetworkId = 1;
             mNetworkId = 1;
@@ -146,26 +156,31 @@ public class TestAccessPointBuilder {
        return this;
        return this;
    }
    }


    @Keep
    public TestAccessPointBuilder setSecurity(int security) {
    public TestAccessPointBuilder setSecurity(int security) {
        mSecurity = security;
        mSecurity = security;
        return this;
        return this;
    }
    }


    @Keep
    public TestAccessPointBuilder setSsid(String newSsid) {
    public TestAccessPointBuilder setSsid(String newSsid) {
        ssid = newSsid;
        ssid = newSsid;
        return this;
        return this;
    }
    }


    @Keep
    public TestAccessPointBuilder setFqdn(String fqdn) {
    public TestAccessPointBuilder setFqdn(String fqdn) {
        mFqdn = fqdn;
        mFqdn = fqdn;
        return this;
        return this;
    }
    }


    @Keep
    public TestAccessPointBuilder setProviderFriendlyName(String friendlyName) {
    public TestAccessPointBuilder setProviderFriendlyName(String friendlyName) {
        mProviderFriendlyName = friendlyName;
        mProviderFriendlyName = friendlyName;
        return this;
        return this;
    }
    }


    @Keep
    public TestAccessPointBuilder setWifiInfo(WifiInfo info) {
    public TestAccessPointBuilder setWifiInfo(WifiInfo info) {
        mWifiInfo = info;
        mWifiInfo = info;
        return this;
        return this;
@@ -177,6 +192,7 @@ public class TestAccessPointBuilder {
     * <p>Setting this to a value other than {@link WifiConfiguration#INVALID_NETWORK_ID} makes this
     * <p>Setting this to a value other than {@link WifiConfiguration#INVALID_NETWORK_ID} makes this
     * AccessPoint a saved network.
     * AccessPoint a saved network.
     */
     */
    @Keep
    public TestAccessPointBuilder setNetworkId(int networkId) {
    public TestAccessPointBuilder setNetworkId(int networkId) {
        mNetworkId = networkId;
        mNetworkId = networkId;
        return this;
        return this;