summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormukesh agrawal <quiche@google.com>2017-03-29 23:21:42 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-29 23:21:42 +0000
commitd41c59923b6fc4a70a1bd0cdb42c48892e2a5728 (patch)
tree58a417e604d160e39918a225bf106e525f064b53
parent92797f55657a3d45e423f3f37ef3d71cc29c33dc (diff)
parentad71cfd481443b600b06e4421e8971e09fb44de7 (diff)
WifiStateMachine: exclude CMD_RSSI_POLL for LogRecs
am: ad71cfd481 Change-Id: I951eb77d304d3869660131cb1cf5328e138d4f38
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java10
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java33
2 files changed, 43 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index e8d85cd75..ccd1d465a 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -2185,6 +2185,16 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
}
}
+ @Override
+ protected boolean recordLogRec(Message msg) {
+ switch (msg.what) {
+ case CMD_RSSI_POLL:
+ return mVerboseLoggingEnabled;
+ default:
+ return true;
+ }
+ }
+
/**
* Return the additional string to be logged by LogRec, default
*
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index ad441f54d..17f20a24f 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -1087,6 +1087,39 @@ public class WifiStateMachineTest {
assertEquals(WifiStateMachine.NUM_LOG_RECS_NORMAL, mWsm.getLogRecMaxSize());
}
+ @Test
+ public void logRecsIncludeDisconnectCommand() {
+ // There's nothing special about the DISCONNECT command. It's just representative of
+ // "normal" commands.
+ mWsm.sendMessage(WifiStateMachine.CMD_DISCONNECT);
+ mLooper.dispatchAll();
+ assertEquals(1, mWsm.copyLogRecs()
+ .stream()
+ .filter(logRec -> logRec.getWhat() == WifiStateMachine.CMD_DISCONNECT)
+ .count());
+ }
+
+ @Test
+ public void logRecsExcludeRssiPollCommandByDefault() {
+ mWsm.sendMessage(WifiStateMachine.CMD_RSSI_POLL);
+ mLooper.dispatchAll();
+ assertEquals(0, mWsm.copyLogRecs()
+ .stream()
+ .filter(logRec -> logRec.getWhat() == WifiStateMachine.CMD_RSSI_POLL)
+ .count());
+ }
+
+ @Test
+ public void logRecsIncludeRssiPollCommandWhenVerboseLoggingIsEnabled() {
+ mWsm.enableVerboseLogging(1);
+ mWsm.sendMessage(WifiStateMachine.CMD_RSSI_POLL);
+ mLooper.dispatchAll();
+ assertEquals(1, mWsm.copyLogRecs()
+ .stream()
+ .filter(logRec -> logRec.getWhat() == WifiStateMachine.CMD_RSSI_POLL)
+ .count());
+ }
+
/** Verifies that enabling verbose logging sets the hal log property in eng builds. */
@Test
public void enablingVerboseLoggingSetsHalLogPropertyInEngBuilds() {