Merge "The Settings app is listening to wpa_supplicant state change so as to update the state of the AccessPoint objects and present Wifi state to the user." into lmp-dev
This commit is contained in:
@@ -427,17 +427,12 @@ class AccessPoint extends Preference {
|
|||||||
StringBuilder visibility = new StringBuilder();
|
StringBuilder visibility = new StringBuilder();
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
long age = (now - mSeen);
|
|
||||||
if (age < VISIBILITY_MAX_AGE_IN_MILLI) {
|
|
||||||
//show age in seconds, in the form xx
|
|
||||||
visibility.append(Long.toString((age / SECOND_TO_MILLI) % SECOND_TO_MILLI))
|
|
||||||
.append("s");
|
|
||||||
} else {
|
|
||||||
//not seen for more than 1000 seconds
|
|
||||||
visibility.append("!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mInfo != null) {
|
if (mInfo != null) {
|
||||||
|
String bssid = mInfo.getBSSID();
|
||||||
|
if (bssid != null) {
|
||||||
|
visibility.append(" ").append(bssid);
|
||||||
|
}
|
||||||
visibility.append(" sc=").append(Integer.toString(mInfo.score));
|
visibility.append(" sc=").append(Integer.toString(mInfo.score));
|
||||||
visibility.append(" ");
|
visibility.append(" ");
|
||||||
visibility.append(String.format("tx=%.1f,", mInfo.txSuccessRate));
|
visibility.append(String.format("tx=%.1f,", mInfo.txSuccessRate));
|
||||||
|
@@ -38,7 +38,6 @@ import android.net.NetworkScoreManager;
|
|||||||
import android.net.NetworkScorerAppManager;
|
import android.net.NetworkScorerAppManager;
|
||||||
import android.net.NetworkScorerAppManager.NetworkScorerAppData;
|
import android.net.NetworkScorerAppManager.NetworkScorerAppData;
|
||||||
import android.net.wifi.ScanResult;
|
import android.net.wifi.ScanResult;
|
||||||
import android.net.wifi.SupplicantState;
|
|
||||||
import android.net.wifi.WifiConfiguration;
|
import android.net.wifi.WifiConfiguration;
|
||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
@@ -871,23 +870,6 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION.equals(action) ||
|
WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION.equals(action) ||
|
||||||
WifiManager.LINK_CONFIGURATION_CHANGED_ACTION.equals(action)) {
|
WifiManager.LINK_CONFIGURATION_CHANGED_ACTION.equals(action)) {
|
||||||
updateAccessPoints();
|
updateAccessPoints();
|
||||||
} else if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) {
|
|
||||||
//Ignore supplicant state changes when network is connected
|
|
||||||
//TODO: we should deprecate SUPPLICANT_STATE_CHANGED_ACTION and
|
|
||||||
//introduce a broadcast that combines the supplicant and network
|
|
||||||
//network state change events so the apps dont have to worry about
|
|
||||||
//ignoring supplicant state change when network is connected
|
|
||||||
//to get more fine grained information.
|
|
||||||
SupplicantState state = (SupplicantState) intent.getParcelableExtra(
|
|
||||||
WifiManager.EXTRA_NEW_STATE);
|
|
||||||
if (!mConnected.get() && SupplicantState.isHandshakeState(state)) {
|
|
||||||
updateConnectionState(WifiInfo.getDetailedStateOf(state));
|
|
||||||
} else {
|
|
||||||
// During a connect, we may have the supplicant
|
|
||||||
// state change affect the detailed network state.
|
|
||||||
// Make sure a lost connection is updated as well.
|
|
||||||
updateConnectionState(null);
|
|
||||||
}
|
|
||||||
} else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) {
|
} else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) {
|
||||||
NetworkInfo info = (NetworkInfo) intent.getParcelableExtra(
|
NetworkInfo info = (NetworkInfo) intent.getParcelableExtra(
|
||||||
WifiManager.EXTRA_NETWORK_INFO);
|
WifiManager.EXTRA_NETWORK_INFO);
|
||||||
|
Reference in New Issue
Block a user