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

Commit cd7167db authored by Rebecca Silberstein's avatar Rebecca Silberstein
Browse files

Add hasEverConnected to NetworkStatus object

Add a boolean indicating if we have ever successfully connected to a
network given the current configuration.  This value should be set to
true upon a successful connection and set to false if the credentials
change.  The default value is false.

BUG: 27855896
Change-Id: I1af8f4ad7aac622b48f3c90d88b0debd671a1f40
parent 35a568fd
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -937,6 +937,15 @@ public class WifiConfiguration implements Parcelable {
         */
        private boolean mSeenInLastQualifiedNetworkSelection;

        /**
         * Boolean indicating if we have ever successfully connected to this network.
         *
         * This value will be set to true upon a successful connection.
         * This value will be set to false if a previous value was not stored in the config or if
         * the credentials are updated (ex. a password change).
         */
        private boolean mHasEverConnected;

        /**
         * set whether this network is visible in latest Qualified Network Selection
         * @param seen value set to candidate
@@ -1027,7 +1036,18 @@ public class WifiConfiguration implements Parcelable {
            return QUALITY_NETWORK_SELECTION_STATUS[mStatus];
        }

        private NetworkSelectionStatus() {};
        public void setHasEverConnected(boolean value) {
            mHasEverConnected = value;
        }

        public boolean getHasEverConnected() {
            return mHasEverConnected;
        }

        private NetworkSelectionStatus() {
            // previously stored configs will not have this parameter, so we default to false.
            mHasEverConnected = false;
        };

        /**
         * @param reason specific error reason
@@ -1226,6 +1246,7 @@ public class WifiConfiguration implements Parcelable {
            mNetworkSelectionBSSID = source.mNetworkSelectionBSSID;
            setConnectChoice(source.getConnectChoice());
            setConnectChoiceTimestamp(source.getConnectChoiceTimestamp());
            setHasEverConnected(source.getHasEverConnected());
        }

        public void writeToParcel(Parcel dest) {
@@ -1244,6 +1265,7 @@ public class WifiConfiguration implements Parcelable {
            } else {
                dest.writeInt(CONNECT_CHOICE_NOT_EXISTS);
            }
            dest.writeInt(getHasEverConnected() ? 1 : 0);
        }

        public void readFromParcel(Parcel in) {
@@ -1262,6 +1284,7 @@ public class WifiConfiguration implements Parcelable {
                setConnectChoice(null);
                setConnectChoiceTimestamp(INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP);
            }
            setHasEverConnected(in.readInt() != 0);
        }
    }

@@ -1389,6 +1412,8 @@ public class WifiConfiguration implements Parcelable {
            sbuf.append(" connect choice set time: ").append(mNetworkSelectionStatus
                    .getConnectChoiceTimestamp());
        }
        sbuf.append(" hasEverConnected: ")
                .append(mNetworkSelectionStatus.getHasEverConnected()).append("\n");

        if (this.numAssociation > 0) {
            sbuf.append(" numAssociation ").append(this.numAssociation).append("\n");