summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2017-09-18 15:18:45 -0700
committerNingyuan Wang <nywang@google.com>2017-10-04 18:07:05 -0700
commit470817b13e56d915805729ab4f51075f3fa2ec15 (patch)
treee1bc495d0755892089954aebf87001c4f18f5e31 /service
parent70954f46ffb95cbf3d6c9d12495be20edf2b3530 (diff)
Blame scan request from WifiManager.reconnect()
Bug: 65839442 Test: compile, unit tests Test: 1. Write a simple cts test case WifiManagerTest#testWifiReconnect only calling WifiManager.reconnect() 2. Make sure wifi is disconnected 3. Run cts test using: cts-tradefed run cts -m CtsNetTestCases -t android.net.wifi.cts.WifiManagerTest#testWifiReconnect 4. Grab bugreport 5. Verify the following logs appears: forceConnectivityScan in request of WorkSource{...} Change-Id: I7fa7803e90ba950c9331a55cb1268baef4ae02a8
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java17
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java2
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java9
3 files changed, 15 insertions, 13 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 6bfce74db..458f73ae6 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -31,6 +31,7 @@ import android.net.wifi.WifiScanner.ScanSettings;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
+import android.os.WorkSource;
import android.util.LocalLog;
import android.util.Log;
@@ -215,7 +216,7 @@ public class WifiConnectivityManager {
@Override
public void onAlarm() {
- startSingleScan(mIsFullBandScan);
+ startSingleScan(mIsFullBandScan, WIFI_WORK_SOURCE);
}
}
@@ -795,7 +796,7 @@ public class WifiConnectivityManager {
localLog("start a single scan from watchdogHandler");
scheduleWatchdogTimer();
- startSingleScan(true);
+ startSingleScan(true, WIFI_WORK_SOURCE);
}
}
@@ -824,7 +825,7 @@ public class WifiConnectivityManager {
}
mLastPeriodicSingleScanTimeStamp = currentTimeStamp;
- startSingleScan(isFullBandScan);
+ startSingleScan(isFullBandScan, WIFI_WORK_SOURCE);
schedulePeriodicScanTimer(mPeriodicSingleScanInterval);
// Set up the next scan interval in an exponential backoff fashion.
@@ -851,7 +852,7 @@ public class WifiConnectivityManager {
}
// Start a single scan
- private void startSingleScan(boolean isFullBandScan) {
+ private void startSingleScan(boolean isFullBandScan, WorkSource workSource) {
if (!mWifiEnabled || !mWifiConnectivityManagerEnabled) {
return;
}
@@ -876,7 +877,7 @@ public class WifiConnectivityManager {
SingleScanListener singleScanListener =
new SingleScanListener(isFullBandScan);
- mScanner.startScan(settings, singleScanListener, WIFI_WORK_SOURCE);
+ mScanner.startScan(settings, singleScanListener, workSource);
}
// Start a periodic scan when screen is on
@@ -1133,11 +1134,11 @@ public class WifiConnectivityManager {
/**
* Handler for on-demand connectivity scan
*/
- public void forceConnectivityScan() {
- localLog("forceConnectivityScan");
+ public void forceConnectivityScan(WorkSource workSource) {
+ localLog("forceConnectivityScan in request of " + workSource);
mWaitForFullBandScanResults = true;
- startSingleScan(true);
+ startSingleScan(true, workSource);
}
/**
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index bb995b7d1..c83f6c6bd 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -1421,7 +1421,7 @@ public class WifiServiceImpl extends IWifiManager.Stub {
public void reconnect() {
enforceChangePermission();
mLog.info("reconnect uid=%").c(Binder.getCallingUid()).flush();
- mWifiStateMachine.reconnectCommand();
+ mWifiStateMachine.reconnectCommand(new WorkSource(Binder.getCallingUid()));
}
/**
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 9e124463d..d6723cac3 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -1873,8 +1873,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
/**
* Initiate a reconnection to AP
*/
- public void reconnectCommand() {
- sendMessage(CMD_RECONNECT);
+ public void reconnectCommand(WorkSource workSource) {
+ sendMessage(CMD_RECONNECT, workSource);
}
/**
@@ -4535,7 +4535,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
mEnableAutoJoinWhenAssociated = allowed;
if (!old_state && allowed && mScreenOn
&& getCurrentState() == mConnectedState) {
- mWifiConnectivityManager.forceConnectivityScan();
+ mWifiConnectivityManager.forceConnectivityScan(WIFI_WORK_SOURCE);
}
break;
case CMD_SELECT_TX_POWER_SCENARIO:
@@ -5158,7 +5158,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
mPasspointManager.getMatchingOsuProviders((ScanResult) message.obj));
break;
case CMD_RECONNECT:
- mWifiConnectivityManager.forceConnectivityScan();
+ WorkSource workSource = (WorkSource) message.obj;
+ mWifiConnectivityManager.forceConnectivityScan(workSource);
break;
case CMD_REASSOCIATE:
lastConnectAttemptTimestamp = mClock.getWallClockMillis();