WifiHealthMonitor: improve regression detection
Current SW regression detection uses the following logic
isRegression = recentFailureRate >= highThr && previousFailureRate <= lowThr;
This logic works well when the network starts with a low failure value (e.g., 0~5%) and then increase to a high value (e.g., 20%).
However, this may not work well when the network starts with a high value (e.g. 20%) and then failure rate further increases to a higher value (e.g., 40%). This case is possible, e.g., enterprise network.
To make it work in the above case, change the regression detection logic to
isRegression = recentFailureRate / previousFailureRate >= failureRateRatioMinThr
&& recentFailureCnt >= failureCntMinThr
The 2nd check is to ensure the detection confidence level is high when minConnectionAttempt is small.
In addition, use Laplace's rule of succession to calculate the
probability of failure p = (f + 1) / (n + 2) which has a better
estimation especially for small n.
Bug: 152096939
Test: atest com.android.server.wifi
Change-Id: I037c1a4f80f8094580209765ec31f933cb5d50fa
5 files changed