diff options
author | vandwalle <vandwalle@google.com> | 2014-12-09 15:16:34 -0800 |
---|---|---|
committer | vandwalle <vandwalle@google.com> | 2014-12-10 22:34:59 -0800 |
commit | 8ccabb81ad304b80dc8eaa162fd322643461529b (patch) | |
tree | e17188684443884a02606313ae65f1434b2bdf25 | |
parent | 93a1fddee50a244d31036cddae6b7db6630fd93d (diff) | |
download | android_frameworks_opt_net_wifi-8ccabb81ad304b80dc8eaa162fd322643461529b.tar.gz android_frameworks_opt_net_wifi-8ccabb81ad304b80dc8eaa162fd322643461529b.tar.bz2 android_frameworks_opt_net_wifi-8ccabb81ad304b80dc8eaa162fd322643461529b.zip |
handle beacons reported with wrong RSSI value of 0
Bug:18654243
Change-Id: Ied2fbc87c7effc23fecb68e9863153d63c0cfba4
-rw-r--r-- | service/java/com/android/server/wifi/WifiAutoJoinController.java | 12 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigStore.java | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiAutoJoinController.java b/service/java/com/android/server/wifi/WifiAutoJoinController.java index 0dfa3fb7b..596a61d92 100644 --- a/service/java/com/android/server/wifi/WifiAutoJoinController.java +++ b/service/java/com/android/server/wifi/WifiAutoJoinController.java @@ -171,11 +171,23 @@ public class WifiAutoJoinController { // Fetch the previous instance for this result ScanResult sr = scanResultCache.get(result.BSSID); if (sr != null) { + if (mWifiConfigStore.scanResultRssiLevelPatchUp != 0 + && result.level == 0 + && sr.level < -20) { + // A 'zero' RSSI reading is most likely a chip problem which returns + // an unknown RSSI, hence ignore it + result.level = sr.level; + } + // If there was a previous cache result for this BSSID, average the RSSI values result.averageRssi(sr.level, sr.seen, mScanResultMaximumAge); // Remove the previous Scan Result - this is not necessary scanResultCache.remove(result.BSSID); + } else if (mWifiConfigStore.scanResultRssiLevelPatchUp != 0 && result.level == 0) { + // A 'zero' RSSI reading is most likely a chip problem which returns + // an unknown RSSI, hence initialize it to a sane value + result.level = mWifiConfigStore.scanResultRssiLevelPatchUp; } if (!mNetworkScoreCache.isScoredNetwork(result)) { diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java index 028e2bb42..cf4163557 100644 --- a/service/java/com/android/server/wifi/WifiConfigStore.java +++ b/service/java/com/android/server/wifi/WifiConfigStore.java @@ -387,6 +387,7 @@ public class WifiConfigStore extends IpConfigStore { public boolean enableWifiCellularHandoverUserTriggeredAdjustment = true; public int currentNetworkBoost = 25; + public int scanResultRssiLevelPatchUp = -85; /** * Regex pattern for extracting a connect choice. @@ -539,8 +540,12 @@ public class WifiConfigStore extends IpConfigStore { enableAutoJoinWhenAssociated = mContext.getResources().getBoolean( R.bool.config_wifi_framework_enable_associated_network_selection); + currentNetworkBoost = mContext.getResources().getInteger( R.integer.config_wifi_framework_current_network_boost); + + scanResultRssiLevelPatchUp = mContext.getResources().getInteger( + R.integer.config_wifi_framework_scan_result_rssi_level_patchup_value); } void enableVerboseLogging(int verbose) { |