Bug fix of high RSSI scan suppression w/o traffic

At high RSSI, with low or light traffic, scan should be suppressed for most of time. With the current logic in WifiNetworkSelector.isNetworkSufficient(), it returns false. To fix this, add hasSufficientLinkQuality() in periodic scan suppression logic.

In addition, add logic to allow scan at high rssi if the last network selection happens a long time ago. To avoid disruption to ongoing traffic, scan is always skipped when there is active traffic.

Bug: 150884261
Test: atest com.android.server.wifi
Test: manual test to confirm that at high riss scan only happens at
~10 min interval if there is no traffic and is suppressed completely if
there is traffic with the following steps
1) enable Wi-Fi verbose logging in developer option
2) set Display -> screen timeout to "after 30mins of inactivity"
3) leave screen on, enable wifi and connect to a network
4) run adb command "adb logcat WifiHealthMonitor:d *:s"
5) check scan message from the command line.
6) to check traffic case, repeat the above steps while running ping from
adb shell with 50ms interval (ping -i 0.05 google.com). adb root is
needed because small ping interval is only allowed with root.

Change-Id: I4cb5b3a29416400e96325bcd946c0a50709e415c
5 files changed