Commit f57f8918 authored by vandwalle's avatar vandwalle
Browse files

add debug logs to confirm network flapping issue is fixed

Bug:18706288

Change-Id: I27a86aeb650a63511b667244b0138afbc1bc059e
parent 16fdf070
......@@ -24,6 +24,7 @@ import android.net.wifi.*;
import android.net.wifi.WifiConfiguration.KeyMgmt;
import android.os.SystemClock;
import android.provider.Settings;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
......@@ -612,7 +613,7 @@ public class WifiAutoJoinController {
bRssiBoost5 = rssiBoostFrom5GHzRssi(b.visibility.rssi5, b.configKey() + "->");
// Select which band to use for a
if (a.visibility.rssi5 + aRssiBoost5 > b.visibility.rssi24) {
if (a.visibility.rssi5 + aRssiBoost5 > a.visibility.rssi24) {
// Prefer a's 5GHz
aPrefers5GHz = true;
}
......@@ -652,8 +653,21 @@ public class WifiAutoJoinController {
}
if (VDBG) {
logDbg(" " + a.configKey() + " is5=" + aPrefers5GHz + " score=" + aScore
+ b.configKey() + " is5=" + bPrefers5GHz + " score=" + bScore);
+ " " + b.configKey() + " is5=" + bPrefers5GHz + " score=" + bScore);
}
// Debug only, record RSSI comparison parameters
if (a.visibility != null) {
a.visibility.score = aScore;
a.visibility.currentNetworkBoost = aRssiBoost;
a.visibility.bandPreferenceBoost = aRssiBoost5;
}
if (b.visibility != null) {
b.visibility.score = bScore;
b.visibility.currentNetworkBoost = bRssiBoost;
b.visibility.bandPreferenceBoost = bRssiBoost5;
}
// Compare a and b
// If a score is higher then a > b and the order is descending (negative)
// If b score is higher then a < b and the order is ascending (positive)
......@@ -698,10 +712,10 @@ public class WifiAutoJoinController {
if (VDBG) {
logDbg(" compareWifiConfigurationsRSSI: " + a.configKey()
+ " " + Integer.toString(astatus.rssi24)
+ " rssi=" + Integer.toString(astatus.rssi24)
+ "," + Integer.toString(astatus.rssi5)
+ " boost=" + Integer.toString(aRssiBoost)
+ " " + b.configKey() + " "
+ " " + b.configKey() + " rssi="
+ Integer.toString(bstatus.rssi24) + ","
+ Integer.toString(bstatus.rssi5)
+ " boost=" + Integer.toString(bRssiBoost)
......@@ -844,6 +858,10 @@ public class WifiAutoJoinController {
+ " due to user choice of " + choice
+ " order -> " + Integer.toString(order));
}
if (a.visibility != null) {
a.visibility.lastChoiceBoost = choice;
a.visibility.lastChoiceConfig = b.configKey();
}
}
choice = getConnectChoice(b, a);
......@@ -855,6 +873,10 @@ public class WifiAutoJoinController {
+ a.configKey() + " due to user choice of " + choice
+ " order ->" + Integer.toString(order));
}
if (b.visibility != null) {
b.visibility.lastChoiceBoost = choice;
b.visibility.lastChoiceConfig = a.configKey();
}
}
}
......@@ -942,7 +964,7 @@ public class WifiAutoJoinController {
boost = 50;
}
if (VDBG && dbg != null) {
logDbg(" " + dbg + ": rssi5 " + rssi + " boost " + boost);
logDbg(" " + dbg + ": rssi5 " + rssi + " 5GHz-boost " + boost);
}
return boost;
}
......@@ -1335,7 +1357,8 @@ public class WifiAutoJoinController {
// since we connected, or the scored BSSID has gone out of range.
// Drop the current connection and perform the rest of autojoin.
logDbg("attemptAutoJoin() disconnecting from unwanted ephemeral network");
mWifiStateMachine.disconnectCommand();
mWifiStateMachine.disconnectCommand(Process.WIFI_UID,
mAllowUntrustedConnections ? 1 : 0);
return false;
} else {
mCurrentConfigurationKey = currentConfiguration.configKey();
......
......@@ -1440,9 +1440,8 @@ public class WifiConfigStore extends IpConfigStore {
if (config.SSID != null) {
csum.update(config.SSID.getBytes(), 0, config.SSID.getBytes().length);
long d = csum.getValue();
loge(" got CRC SSID " + config.SSID + " -> " + d);
if (mDeletedSSIDs.contains(d)) {
loge(" was deleted");
loge(" got CRC for SSID " + config.SSID + " -> " + d + ", was deleted");
}
}
......
......@@ -973,8 +973,6 @@ public class WifiMonitor {
Matcher match = mTargetBSSIDPattern.matcher(eventStr);
if (match.find()) {
BSSID = match.group(1);
} else {
Log.d(TAG, "didn't find BSSID " + eventStr);
}
mStateMachine.sendMessage(WifiStateMachine.CMD_TARGET_BSSID, eventLogCounter, 0, BSSID);
}
......@@ -984,8 +982,6 @@ public class WifiMonitor {
Matcher match = mAssociatedPattern.matcher(eventStr);
if (match.find()) {
BSSID = match.group(1);
} else {
Log.d(TAG, "handleAssociatedBSSIDEvent: didn't find BSSID " + eventStr);
}
mStateMachine.sendMessage(WifiStateMachine.CMD_ASSOCIATED_BSSID, eventLogCounter, 0, BSSID);
}
......
......@@ -2092,6 +2092,10 @@ public class WifiStateMachine extends StateMachine {
sendMessage(CMD_DISCONNECT);
}
public void disconnectCommand(int uid, int reason) {
sendMessage(CMD_DISCONNECT, uid, reason);
}
/**
* Initiate a reconnection to AP
*/
......@@ -2755,10 +2759,7 @@ public class WifiStateMachine extends StateMachine {
if (config != null) {
sb.append(" ").append(config.configKey());
if (config.visibility != null) {
sb.append(" [").append(config.visibility.num24);
sb.append(" ,").append(config.visibility.rssi24);
sb.append(" ;").append(config.visibility.num5);
sb.append(" ,").append(config.visibility.rssi5).append("]");
sb.append(" ").append(config.visibility.toString());
}
}
if (mTargetRoamBSSID != null) {
......@@ -2768,12 +2769,9 @@ public class WifiStateMachine extends StateMachine {
sb.append(printTime());
config = getCurrentWifiConfiguration();
if (config != null) {
sb.append(" ").append(config.configKey());
sb.append(config.configKey());
if (config.visibility != null) {
sb.append(" [").append(config.visibility.num24);
sb.append(" ,").append(config.visibility.rssi24);
sb.append(" ;").append(config.visibility.num5);
sb.append(" ,").append(config.visibility.rssi5).append("]");
sb.append(" ").append(config.visibility.toString());
}
}
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment