summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java11
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java7
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardNetworkDetailsTracker.java7
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java10
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiPickerTracker.java24
5 files changed, 46 insertions, 13 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java
index 2c749ad2e..bc551c20d 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java
@@ -109,6 +109,8 @@ public class BaseWifiTracker implements LifecycleObserver {
handleConfiguredNetworksChangedAction(intent);
} else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) {
handleNetworkStateChangedAction(intent);
+ } else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) {
+ handleRssiChangedAction();
}
}
};
@@ -199,6 +201,7 @@ public class BaseWifiTracker implements LifecycleObserver {
filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
filter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION);
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
+ filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
mContext.registerReceiver(mBroadcastReceiver, filter,
/* broadcastPermission */ null, mWorkerHandler);
mConnectivityManager.registerNetworkCallback(mNetworkRequest, mNetworkCallback,
@@ -279,6 +282,14 @@ public class BaseWifiTracker implements LifecycleObserver {
}
/**
+ * Handle receiving the WifiManager.RSSI_CHANGED_ACTION broadcast
+ */
+ @WorkerThread
+ protected void handleRssiChangedAction() {
+ // Do nothing.
+ }
+
+ /**
* Handle link property changes for the current connected Wifi network.
*/
@WorkerThread
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java
index a5b489a72..22d200fc2 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java
@@ -119,6 +119,13 @@ class PasspointNetworkDetailsTracker extends NetworkDetailsTracker {
@WorkerThread
@Override
+ protected void handleRssiChangedAction() {
+ mChosenEntry.updateConnectionInfo(mWifiManager.getConnectionInfo(),
+ mConnectivityManager.getActiveNetworkInfo());
+ }
+
+ @WorkerThread
+ @Override
protected void handleNetworkStateChangedAction(@NonNull Intent intent) {
checkNotNull(intent, "Intent cannot be null!");
mChosenEntry.updateConnectionInfo(mWifiManager.getConnectionInfo(),
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardNetworkDetailsTracker.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardNetworkDetailsTracker.java
index 68f58ddc3..65560d60f 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardNetworkDetailsTracker.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardNetworkDetailsTracker.java
@@ -132,6 +132,13 @@ class StandardNetworkDetailsTracker extends NetworkDetailsTracker {
@WorkerThread
@Override
+ protected void handleRssiChangedAction() {
+ mChosenEntry.updateConnectionInfo(mWifiManager.getConnectionInfo(),
+ mConnectivityManager.getActiveNetworkInfo());
+ }
+
+ @WorkerThread
+ @Override
protected void handleLinkPropertiesChanged(@Nullable LinkProperties linkProperties) {
if (mChosenEntry.getConnectedState() == CONNECTED_STATE_CONNECTED) {
mChosenEntry.updateLinkProperties(linkProperties);
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
index a6c322656..f6c3a2b2e 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
@@ -643,14 +643,16 @@ public class StandardWifiEntry extends WifiEntry {
}
final ScanResult bestScanResult = getBestScanResultByLevel(scanResults);
- if (bestScanResult == null) {
- mLevel = WIFI_LEVEL_UNREACHABLE;
- } else {
- mLevel = mWifiManager.calculateSignalLevel(bestScanResult.level);
+ if (bestScanResult != null) {
updateEapType(bestScanResult);
updatePskType(bestScanResult);
}
+ if (getConnectedState() == CONNECTED_STATE_DISCONNECTED) {
+ mLevel = bestScanResult != null
+ ? mWifiManager.calculateSignalLevel(bestScanResult.level)
+ : WIFI_LEVEL_UNREACHABLE;
+ }
notifyOnUpdated();
}
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiPickerTracker.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiPickerTracker.java
index c08b47cd1..86845c7b4 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiPickerTracker.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiPickerTracker.java
@@ -187,10 +187,6 @@ public class WifiPickerTracker extends BaseWifiTracker {
final WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
final NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
updateConnectionInfo(wifiInfo, networkInfo);
- // Create a StandardWifiEntry for the current connection if there are no scan results yet.
- conditionallyCreateConnectedStandardWifiEntry(wifiInfo, networkInfo);
- conditionallyCreateConnectedSuggestedWifiEntry(wifiInfo, networkInfo);
- conditionallyCreateConnectedPasspointWifiEntry(wifiInfo, networkInfo);
handleLinkPropertiesChanged(mConnectivityManager.getLinkProperties(
mWifiManager.getCurrentNetwork()));
notifyOnNumSavedNetworksChanged();
@@ -222,7 +218,7 @@ public class WifiPickerTracker extends BaseWifiTracker {
final WifiConfiguration config =
(WifiConfiguration) intent.getExtra(WifiManager.EXTRA_WIFI_CONFIGURATION);
- if (config != null && !config.isPasspoint() && !config.fromWifiNetworkSuggestion) {
+ if (config != null && !config.isEphemeral() && !config.isPasspoint()) {
updateStandardWifiEntryConfig(
config, (Integer) intent.getExtra(WifiManager.EXTRA_CHANGE_REASON));
} else {
@@ -250,15 +246,21 @@ public class WifiPickerTracker extends BaseWifiTracker {
final NetworkInfo networkInfo =
(NetworkInfo) intent.getExtra(WifiManager.EXTRA_NETWORK_INFO);
updateConnectionInfo(wifiInfo, networkInfo);
- // Create a StandardWifiEntry for the current connection if there are no scan results yet.
- conditionallyCreateConnectedStandardWifiEntry(wifiInfo, networkInfo);
- conditionallyCreateConnectedSuggestedWifiEntry(wifiInfo, networkInfo);
- conditionallyCreateConnectedPasspointWifiEntry(wifiInfo, networkInfo);
updateWifiEntries();
}
@WorkerThread
@Override
+ protected void handleRssiChangedAction() {
+ if (mConnectedWifiEntry != null) {
+ final WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
+ final NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
+ mConnectedWifiEntry.updateConnectionInfo(wifiInfo, networkInfo);
+ }
+ }
+
+ @WorkerThread
+ @Override
protected void handleLinkPropertiesChanged(@Nullable LinkProperties linkProperties) {
if (mConnectedWifiEntry != null
&& mConnectedWifiEntry.getConnectedState() == CONNECTED_STATE_CONNECTED) {
@@ -641,6 +643,10 @@ public class WifiPickerTracker extends BaseWifiTracker {
for (WifiEntry entry : mOsuWifiEntryCache.values()) {
entry.updateConnectionInfo(wifiInfo, networkInfo);
}
+ // Create a StandardWifiEntry for the current connection if there are no scan results yet.
+ conditionallyCreateConnectedStandardWifiEntry(wifiInfo, networkInfo);
+ conditionallyCreateConnectedSuggestedWifiEntry(wifiInfo, networkInfo);
+ conditionallyCreateConnectedPasspointWifiEntry(wifiInfo, networkInfo);
}
/**