diff options
author | mukesh agrawal <quiche@google.com> | 2017-03-27 17:19:17 -0700 |
---|---|---|
committer | mukesh agrawal <quiche@google.com> | 2017-04-05 17:24:04 -0700 |
commit | 9a89f4f412a0bac946ad842b437ab9e5e3b59828 (patch) | |
tree | 6d5ddb191c5fafda82442b27ae9eb9ccc02de946 /tests | |
parent | e08dd98aa0f94d479f2b81120e76ef8c0ec779db (diff) |
WifiStateMachine: exclude CMD_RSSI_POLL for LogRecs
Due to the frequency with which we execute CMD_RSSI_POLL
(every 3 seconds, when the screen is on), the CMD_RSSI_POLL
LogRecs often crowd out more useful information.
To resolve this problem: don't include CMD_RSSI_POLL
in the log records maintained by StateMachine. But, to
facilitate debugging of CMD_RSSI_POLL issues, _do_
include CMD_RSSI_POLL when verbose logging is enabled.
Ideally, we'd solve this in some other way, so that the
LogRecs include all commands processed by the WifiStateMachine.
My hope is that we don't lose too much relevant information with
this change, because the consumers of the RSSI data do their
own logging.
Bug: 26960649
Test: unit tests
Change-Id: Icea22f9fe23c29cb5d2ad97b10955b74977d5e1a
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index 5c3504906..d3da2e761 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -1090,6 +1090,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() { |