Fixed WifiWatchdog notification bugs
- Space was truncated on 'disabled' notification
- Disable reason was getting wiped out on subsequent disabled
- disable reason was not propogating to WifiSettings
Change-Id: I2e57ee33d285aad39aabe1b048e7436d364b02f3
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 9455124..a3e460e 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2665,8 +2665,8 @@
<!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems. This is the notification's title / ticker. -->
<string name="wifi_watchdog_network_disabled">Couldn\'t connect to Wi-Fi</string>
- <!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems. This is a partial string of the message, which will also include the (possibly truncated) hotspot name. -->
- <string name="wifi_watchdog_network_disabled_detailed"> has a poor internet connection.</string>
+ <!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems. The complete alert msg is: <hotspot name> + this string, i.e. "Linksys has a poor internet connection" -->
+ <string name="wifi_watchdog_network_disabled_detailed">\u0020has a poor internet connection.</string>
<!-- Do not translate. Default access point SSID used for tethering -->
<string name="wifi_tether_configure_ssid_default" translatable="false">AndroidAP</string>
diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java
index 45c9869..83dda5c 100644
--- a/wifi/java/android/net/wifi/WifiConfigStore.java
+++ b/wifi/java/android/net/wifi/WifiConfigStore.java
@@ -376,7 +376,8 @@
boolean ret = WifiNative.disableNetworkCommand(netId);
synchronized (sConfiguredNetworks) {
WifiConfiguration config = sConfiguredNetworks.get(netId);
- if (config != null) {
+ /* Only change the reason if the network was not previously disabled */
+ if (config != null && config.status != Status.DISABLED) {
config.status = Status.DISABLED;
config.disableReason = reason;
}
@@ -610,7 +611,10 @@
synchronized (sConfiguredNetworks) {
for(WifiConfiguration config : sConfiguredNetworks.values()) {
if(config != null && config.networkId != netId) {
- config.status = Status.DISABLED;
+ if (config.status != Status.DISABLED) {
+ config.status = Status.DISABLED;
+ config.disableReason = WifiConfiguration.DISABLED_UNKNOWN_REASON;
+ }
}
}
}
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index d2a0b30..85a6f27 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -530,6 +530,7 @@
if (source != null) {
networkId = source.networkId;
status = source.status;
+ disableReason = source.disableReason;
SSID = source.SSID;
BSSID = source.BSSID;
preSharedKey = source.preSharedKey;