summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2020-05-29 22:38:32 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-05-29 22:38:32 +0000
commita6fe29a0ad0b6f84dc82820d6f8d520c4bdf4511 (patch)
tree5997862d65056305083d41ad48ca4bec75d25217 /service
parent6e47907012246db4d4440190199b913b0ae3d66a (diff)
parent3eb812da9de7644281495554afbdfeace6e5de52 (diff)
Merge changes I88af4e2d,I85cc20bd into rvc-dev am: 47d386420f am: 3eb812da9d
Change-Id: I85076e2dd3948738566100e207c2ce3ce3604182
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ConfigurationMap.java8
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java7
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkFactory.java14
3 files changed, 25 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/ConfigurationMap.java b/service/java/com/android/server/wifi/ConfigurationMap.java
index 1f21891e3..a050b9cd8 100644
--- a/service/java/com/android/server/wifi/ConfigurationMap.java
+++ b/service/java/com/android/server/wifi/ConfigurationMap.java
@@ -49,8 +49,12 @@ public class ConfigurationMap {
if (config.shared || currentUser.equals(creatorUser)
|| mUserManager.isSameProfileGroup(currentUser, creatorUser)) {
mPerIDForCurrentUser.put(config.networkId, config);
- mScanResultMatchInfoMapForCurrentUser.put(
- ScanResultMatchInfo.fromWifiConfiguration(config), config);
+ // TODO (b/142035508): Add a more generic fix. This cache should only hold saved
+ // networks.
+ if (!config.fromWifiNetworkSpecifier) {
+ mScanResultMatchInfoMapForCurrentUser.put(
+ ScanResultMatchInfo.fromWifiConfiguration(config), config);
+ }
}
return current;
}
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 209044a65..d607b7893 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -2364,6 +2364,9 @@ public class WifiConfigManager {
* @param scanDetail ScanDetail instance to use for looking up the network.
* @return WifiConfiguration object representing the network corresponding to the scanDetail,
* null if none exists.
+ *
+ * TODO (b/142035508): This should only return saved networks (and rename to
+ * getSavedNetworkForScanDetail()).
*/
public WifiConfiguration getConfiguredNetworkForScanDetail(ScanDetail scanDetail) {
ScanResult scanResult = scanDetail.getScanResult();
@@ -2391,6 +2394,8 @@ public class WifiConfigManager {
* {@link #mScanDetailCaches} for the retrieved network.
*
* @param scanDetail input a scanDetail from the scan result
+ * TODO (b/142035508): This should only return saved networks (and rename to
+ * updateScanDetailCacheFromScanDetail()).
*/
public void updateScanDetailCacheFromScanDetail(ScanDetail scanDetail) {
WifiConfiguration network = getConfiguredNetworkForScanDetail(scanDetail);
@@ -2407,6 +2412,8 @@ public class WifiConfigManager {
* @param scanDetail input a scanDetail from the scan result
* @return WifiConfiguration object representing the network corresponding to the scanDetail,
* null if none exists.
+ * TODO (b/142035508): This should only return saved networks (and rename to
+ * getSavedNetworkForScanDetailAndCache()).
*/
public WifiConfiguration getConfiguredNetworkForScanDetailAndCache(ScanDetail scanDetail) {
WifiConfiguration network = getConfiguredNetworkForScanDetail(scanDetail);
diff --git a/service/java/com/android/server/wifi/WifiNetworkFactory.java b/service/java/com/android/server/wifi/WifiNetworkFactory.java
index 98ba5bc94..9dc89addc 100644
--- a/service/java/com/android/server/wifi/WifiNetworkFactory.java
+++ b/service/java/com/android/server/wifi/WifiNetworkFactory.java
@@ -146,6 +146,7 @@ public class WifiNetworkFactory extends NetworkFactory {
private boolean mVerboseLoggingEnabled = false;
private boolean mPeriodicScanTimerSet = false;
private boolean mConnectionTimeoutSet = false;
+ private boolean mIsPeriodicScanEnabled = false;
private boolean mIsPeriodicScanPaused = false;
// We sent a new connection request and are waiting for connection success.
private boolean mPendingConnectionSuccess = false;
@@ -256,6 +257,7 @@ public class WifiNetworkFactory extends NetworkFactory {
public void onAlarm() {
// Trigger the next scan.
startScan();
+ mPeriodicScanTimerSet = false;
}
}
@@ -264,6 +266,7 @@ public class WifiNetworkFactory extends NetworkFactory {
public void onAlarm() {
Log.e(TAG, "Timed-out connecting to network");
handleNetworkConnectionFailure(mUserSelectedNetwork);
+ mConnectionTimeoutSet = false;
}
}
@@ -819,6 +822,7 @@ public class WifiNetworkFactory extends NetworkFactory {
// Cancel the ongoing scans after user selection.
cancelPeriodicScans();
+ mIsPeriodicScanEnabled = false;
// Trigger connection attempts.
handleConnectToNetworkUserSelectionInternal(network);
@@ -918,13 +922,13 @@ public class WifiNetworkFactory extends NetworkFactory {
public void handleScreenStateChanged(boolean screenOn) {
// If there is no active request or if the user has already selected a network,
// ignore screen state changes.
- if (mActiveSpecificNetworkRequest == null || mUserSelectedNetwork != null) return;
+ if (mActiveSpecificNetworkRequest == null || !mIsPeriodicScanEnabled) return;
// Pause periodic scans when the screen is off & resume when the screen is on.
if (screenOn) {
if (mVerboseLoggingEnabled) Log.v(TAG, "Resuming scans on screen on");
- startScan();
mIsPeriodicScanPaused = false;
+ startScan();
} else {
if (mVerboseLoggingEnabled) Log.v(TAG, "Pausing scans on screen off");
cancelPeriodicScans();
@@ -971,6 +975,7 @@ public class WifiNetworkFactory extends NetworkFactory {
mActiveSpecificNetworkRequestSpecifier = null;
mUserSelectedNetwork = null;
mUserSelectedNetworkConnectRetryCount = 0;
+ mIsPeriodicScanEnabled = false;
mIsPeriodicScanPaused = false;
mActiveMatchedScanResults = null;
mPendingConnectionSuccess = false;
@@ -1075,6 +1080,7 @@ public class WifiNetworkFactory extends NetworkFactory {
mScanSettings.hiddenNetworks.add(new WifiScanner.ScanSettings.HiddenNetwork(
addEnclosingQuotes(wns.ssidPatternMatcher.getPath())));
}
+ mIsPeriodicScanEnabled = true;
startScan();
}
@@ -1103,6 +1109,10 @@ public class WifiNetworkFactory extends NetworkFactory {
Log.e(TAG, "Scan triggered when there is no active network request. Ignoring...");
return;
}
+ if (!mIsPeriodicScanEnabled) {
+ Log.e(TAG, "Scan triggered after user selected network. Ignoring...");
+ return;
+ }
if (mVerboseLoggingEnabled) {
Log.v(TAG, "Starting the next scan for " + mActiveSpecificNetworkRequestSpecifier);
}