diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-08-09 22:53:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-08-09 22:53:02 +0000 |
commit | 5a19b6b8f6b4a123371c6a2023a96e9d4f8d6aac (patch) | |
tree | 0cb88c274cebddeefec335d309a411cda709ded9 /service | |
parent | c60208a6ffebf37285f758151663493391fa145e (diff) | |
parent | d383bda9ecef4780b955368ceae911d30943cfa6 (diff) |
Merge "Update frequency of WifiInfo upon connection or roam" into oc-dr1-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ScanDetailCache.java | 16 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 23 |
2 files changed, 36 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/ScanDetailCache.java b/service/java/com/android/server/wifi/ScanDetailCache.java index a65137935..3b69a641b 100644 --- a/service/java/com/android/server/wifi/ScanDetailCache.java +++ b/service/java/com/android/server/wifi/ScanDetailCache.java @@ -67,12 +67,24 @@ public class ScanDetailCache { mMap.put(scanDetail.getBSSIDString(), scanDetail); } - ScanResult get(String bssid) { + /** + * Get ScanResult object corresponding to the provided BSSID. + * + * @param bssid provided BSSID + * @return {@code null} if no match ScanResult is found. + */ + public ScanResult get(String bssid) { ScanDetail scanDetail = getScanDetail(bssid); return scanDetail == null ? null : scanDetail.getScanResult(); } - ScanDetail getScanDetail(String bssid) { + /** + * Get ScanDetail object corresponding to the provided BSSID. + * + * @param bssid provided BSSID + * @return {@code null} if no match ScanDetail is found. + */ + public ScanDetail getScanDetail(String bssid) { return mMap.get(bssid); } diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 9d82f5d7b..3649f8f4c 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -3267,6 +3267,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss if (scanDetailCache != null) { ScanDetail scanDetail = scanDetailCache.getScanDetail(stateChangeResult.BSSID); if (scanDetail != null) { + mWifiInfo.setFrequency(scanDetail.getScanResult().frequency); NetworkDetail networkDetail = scanDetail.getNetworkDetail(); if (networkDetail != null && networkDetail.getAnt() == NetworkDetail.Ant.ChargeablePublic) { @@ -5399,6 +5400,15 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss if (config != null) { mWifiInfo.setBSSID(mLastBssid); mWifiInfo.setNetworkId(mLastNetworkId); + + ScanDetailCache scanDetailCache = + mWifiConfigManager.getScanDetailCacheForNetwork(config.networkId); + if (scanDetailCache != null && mLastBssid != null) { + ScanResult scanResult = scanDetailCache.get(mLastBssid); + if (scanResult != null) { + mWifiInfo.setFrequency(scanResult.frequency); + } + } mWifiConnectivityManager.trackBssid(mLastBssid, true, reasonCode); // We need to get the updated pseudonym from supplicant for EAP-SIM/AKA/AKA' if (config.enterpriseConfig != null @@ -5941,7 +5951,18 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss mLastBssid = (String) message.obj; if (mLastBssid != null && (mWifiInfo.getBSSID() == null || !mLastBssid.equals(mWifiInfo.getBSSID()))) { - mWifiInfo.setBSSID((String) message.obj); + mWifiInfo.setBSSID(mLastBssid); + WifiConfiguration config = getCurrentWifiConfiguration(); + if (config != null) { + ScanDetailCache scanDetailCache = mWifiConfigManager + .getScanDetailCacheForNetwork(config.networkId); + if (scanDetailCache != null) { + ScanResult scanResult = scanDetailCache.get(mLastBssid); + if (scanResult != null) { + mWifiInfo.setFrequency(scanResult.frequency); + } + } + } sendNetworkStateChangeBroadcast(mLastBssid); } break; |