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

Commit ec3e9805 authored by vandwalle's avatar vandwalle
Browse files

dont blacklist wifi config that have had validated internet status in the past

Change-Id: Iadb4e0e1beeb9e582b944e003470815a5a865652
parent e6ef98cf
Loading
Loading
Loading
Loading
+31 −8
Original line number Diff line number Diff line
@@ -352,9 +352,9 @@ public class WifiConfiguration implements Parcelable {

    /**
     * @hide
     * last time we connected, this configuration had no internet access
     * last time we connected, this configuration had validated internet access
     */
    public boolean noInternetAccess;
    public boolean validatedInternetAccess;

    /**
     * @hide
@@ -640,6 +640,22 @@ public class WifiConfiguration implements Parcelable {
     */
    public int numAuthFailures;

    /**
     * @hide
     * Number of reports indicating no Internet Access
     */
    public int numNoInternetAccessReports;

    /**
     * @hide
     * The WiFi configuration is considered to have no internet access for purpose of autojoining
     * if there has been a report of it having no internet access, and, it never have had
     * internet access in the past.
     */
    public boolean hasNoInternetAccess() {
        return numNoInternetAccessReports > 0 && !validatedInternetAccess;
    }

    /**
     * @hide
     * Last time we blacklisted the configuration
@@ -827,7 +843,7 @@ public class WifiConfiguration implements Parcelable {
        selfAdded = false;
        didSelfAdd = false;
        ephemeral = false;
        noInternetAccess = false;
        validatedInternetAccess = false;
        mIpConfiguration = new IpConfiguration();
    }

@@ -974,11 +990,15 @@ public class WifiConfiguration implements Parcelable {
        if (this.numAssociation > 0) {
            sbuf.append(" numAssociation ").append(this.numAssociation).append("\n");
        }
        if (this.numNoInternetAccessReports > 0) {
            sbuf.append(" numNoInternetAccessReports ");
            sbuf.append(this.numNoInternetAccessReports).append("\n");
        }
        if (this.didSelfAdd) sbuf.append(" didSelfAdd");
        if (this.selfAdded) sbuf.append(" selfAdded");
        if (this.noInternetAccess) sbuf.append(" noInternetAccess");
        if (this.validatedInternetAccess) sbuf.append(" validatedInternetAccess");
        if (this.ephemeral) sbuf.append(" ephemeral");
        if (this.didSelfAdd || this.selfAdded || this.noInternetAccess || this.ephemeral) {
        if (this.didSelfAdd || this.selfAdded || this.validatedInternetAccess || this.ephemeral) {
            sbuf.append("\n");
        }
        sbuf.append(" KeyMgmt:");
@@ -1434,7 +1454,7 @@ public class WifiConfiguration implements Parcelable {
            mCachedConfigKey = null; //force null configKey
            autoJoinStatus = source.autoJoinStatus;
            selfAdded = source.selfAdded;
            noInternetAccess = source.noInternetAccess;
            validatedInternetAccess = source.validatedInternetAccess;
            ephemeral = source.ephemeral;
            if (source.visibility != null) {
                visibility = new Visibility(source.visibility);
@@ -1468,6 +1488,7 @@ public class WifiConfiguration implements Parcelable {
                    = source.autoJoinUseAggressiveJoinAttemptThreshold;
            autoJoinBailedDueToLowRssi = source.autoJoinBailedDueToLowRssi;
            dirty = source.dirty;
            numNoInternetAccessReports = source.numNoInternetAccessReports;
        }
    }

@@ -1511,7 +1532,7 @@ public class WifiConfiguration implements Parcelable {
        dest.writeInt(autoJoinStatus);
        dest.writeInt(selfAdded ? 1 : 0);
        dest.writeInt(didSelfAdd ? 1 : 0);
        dest.writeInt(noInternetAccess ? 1 : 0);
        dest.writeInt(validatedInternetAccess ? 1 : 0);
        dest.writeInt(ephemeral ? 1 : 0);
        dest.writeInt(creatorUid);
        dest.writeInt(lastConnectUid);
@@ -1533,6 +1554,7 @@ public class WifiConfiguration implements Parcelable {
        dest.writeInt(numUserTriggeredJoinAttempts);
        dest.writeInt(autoJoinUseAggressiveJoinAttemptThreshold);
        dest.writeInt(autoJoinBailedDueToLowRssi ? 1 : 0);
        dest.writeInt(numNoInternetAccessReports);
    }

    /** Implement the Parcelable interface {@hide} */
@@ -1572,7 +1594,7 @@ public class WifiConfiguration implements Parcelable {
                config.autoJoinStatus = in.readInt();
                config.selfAdded = in.readInt() != 0;
                config.didSelfAdd = in.readInt() != 0;
                config.noInternetAccess = in.readInt() != 0;
                config.validatedInternetAccess = in.readInt() != 0;
                config.ephemeral = in.readInt() != 0;
                config.creatorUid = in.readInt();
                config.lastConnectUid = in.readInt();
@@ -1594,6 +1616,7 @@ public class WifiConfiguration implements Parcelable {
                config.numUserTriggeredJoinAttempts = in.readInt();
                config.autoJoinUseAggressiveJoinAttemptThreshold = in.readInt();
                config.autoJoinBailedDueToLowRssi = in.readInt() != 0;
                config.numNoInternetAccessReports = in.readInt();
                return config;
            }