Merge "Add hasEverConnected to NetworkStatus object" into nyc-dev
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 06dea07..fb2bdd4 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -938,6 +938,15 @@
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 @@
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 @@
mNetworkSelectionBSSID = source.mNetworkSelectionBSSID;
setConnectChoice(source.getConnectChoice());
setConnectChoiceTimestamp(source.getConnectChoiceTimestamp());
+ setHasEverConnected(source.getHasEverConnected());
}
public void writeToParcel(Parcel dest) {
@@ -1244,6 +1265,7 @@
} else {
dest.writeInt(CONNECT_CHOICE_NOT_EXISTS);
}
+ dest.writeInt(getHasEverConnected() ? 1 : 0);
}
public void readFromParcel(Parcel in) {
@@ -1262,6 +1284,7 @@
setConnectChoice(null);
setConnectChoiceTimestamp(INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP);
}
+ setHasEverConnected(in.readInt() != 0);
}
}
@@ -1389,6 +1412,8 @@
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");