summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMukesh Agrawal <quiche@google.com>2017-06-09 00:39:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-06-09 00:39:58 +0000
commit95571223c1eece592650e67c894e4a9f95c2d5ae (patch)
tree611b9b10fdf679444bbd7b3ca7f554851a80ce76
parent91f98fddf00d3098c90e35816aed9cf45ad77dd3 (diff)
parent6fe5d5a2c296ba5f3b7b0492d5c8c1a0dccf5216 (diff)
Merge "add adb hooks for tweaking RSSI poll frequency" into oc-dr1-dev
-rw-r--r--service/java/com/android/server/wifi/WifiShellCommand.java28
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java20
2 files changed, 43 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiShellCommand.java b/service/java/com/android/server/wifi/WifiShellCommand.java
index fc153d1fe..f4db178a8 100644
--- a/service/java/com/android/server/wifi/WifiShellCommand.java
+++ b/service/java/com/android/server/wifi/WifiShellCommand.java
@@ -75,6 +75,30 @@ public class WifiShellCommand extends ShellCommand {
pw.println("IPREACH_DISCONNECT state is "
+ mStateMachine.getIpReachabilityDisconnectEnabled());
return 0;
+ case "set-poll-rssi-interval-msecs":
+ int newPollIntervalMsecs;
+ try {
+ newPollIntervalMsecs = Integer.parseInt(getNextArgRequired());
+ } catch (NumberFormatException e) {
+ pw.println(
+ "Invalid argument to 'set-poll-rssi-interval-msecs' "
+ + "- must be a positive integer");
+ return -1;
+ }
+
+ if (newPollIntervalMsecs < 1) {
+ pw.println(
+ "Invalid argument to 'set-poll-rssi-interval-msecs' "
+ + "- must be a positive integer");
+ return -1;
+ }
+
+ mStateMachine.setPollRssiIntervalMsecs(newPollIntervalMsecs);
+ return 0;
+ case "get-poll-rssi-interval-msecs":
+ pw.println("WifiStateMachine.mPollRssiIntervalMsecs = "
+ + mStateMachine.getPollRssiIntervalMsecs());
+ return 0;
default:
return handleDefaultCommands(cmd);
}
@@ -104,6 +128,10 @@ public class WifiShellCommand extends ShellCommand {
pw.println(" Sets whether CMD_IP_REACHABILITY_LOST events should trigger disconnects.");
pw.println(" get-ipreach-disconnect");
pw.println(" Gets setting of CMD_IP_REACHABILITY_LOST events triggering disconnects.");
+ pw.println(" set-poll-rssi-interval-msecs <int>");
+ pw.println(" Sets the interval between RSSI polls to <int> milliseconds.");
+ pw.println(" get-poll-rssi-interval-msecs");
+ pw.println(" Gets current interval between RSSI polls, in milliseconds.");
pw.println();
}
}
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 06da92545..89675b62d 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -284,6 +284,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
private boolean testNetworkDisconnect = false;
private boolean mEnableRssiPolling = false;
+ // Accessed via Binder thread ({get,set}PollRssiIntervalMsecs), and WifiStateMachine thread.
+ private volatile int mPollRssiIntervalMsecs = DEFAULT_POLL_RSSI_INTERVAL_MSECS;
private int mRssiPollToken = 0;
/* 3 operational states for STA operation: CONNECT_MODE, SCAN_ONLY_MODE, SCAN_ONLY_WIFI_OFF_MODE
* In CONNECT_MODE, the STA can scan and connect to an access point
@@ -311,7 +313,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
* Interval in milliseconds between polling for RSSI
* and linkspeed information
*/
- private static final int POLL_RSSI_INTERVAL_MSECS = 3000;
+ private static final int DEFAULT_POLL_RSSI_INTERVAL_MSECS = 3000;
/**
* Interval in milliseconds between receiving a disconnect event
@@ -379,6 +381,14 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
private long mLastDriverRoamAttempt = 0;
private WifiConfiguration targetWificonfiguration = null;
+ int getPollRssiIntervalMsecs() {
+ return mPollRssiIntervalMsecs;
+ }
+
+ void setPollRssiIntervalMsecs(int newPollIntervalMsecs) {
+ mPollRssiIntervalMsecs = newPollIntervalMsecs;
+ }
+
/**
* Method to clear {@link #mTargetRoamBSSID} and reset the the current connected network's
* bssid in wpa_supplicant after a roam/connect attempt.
@@ -5709,8 +5719,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
mWifiInfo, mNetworkAgent, mAggressiveHandover,
mWifiMetrics);
}
- sendMessageDelayed(obtainMessage(CMD_RSSI_POLL,
- mRssiPollToken, 0), POLL_RSSI_INTERVAL_MSECS);
+ sendMessageDelayed(obtainMessage(CMD_RSSI_POLL, mRssiPollToken, 0),
+ mPollRssiIntervalMsecs);
if (mVerboseLoggingEnabled) sendRssiChangeBroadcast(mWifiInfo.getRssi());
} else {
// Polling has completed
@@ -5727,8 +5737,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
if (mEnableRssiPolling) {
// First poll
fetchRssiLinkSpeedAndFrequencyNative();
- sendMessageDelayed(obtainMessage(CMD_RSSI_POLL,
- mRssiPollToken, 0), POLL_RSSI_INTERVAL_MSECS);
+ sendMessageDelayed(obtainMessage(CMD_RSSI_POLL, mRssiPollToken, 0),
+ mPollRssiIntervalMsecs);
}
break;
case WifiManager.RSSI_PKTCNT_FETCH: