Skip to content

Commit 90a80bb

Browse files
isheriffAndroid (Google) Code Review
authored andcommitted
Merge "Handle null BSSID" into jb-mr1-dev
2 parents 64e5aa7 + edba852 commit 90a80bb

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

wifi/java/android/net/wifi/WifiWatchdogStateMachine.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,8 @@ public boolean processMessage(Message msg) {
556556
mLinkProperties = (LinkProperties) intent.getParcelableExtra(
557557
WifiManager.EXTRA_LINK_PROPERTIES);
558558
if (mPoorNetworkDetectionEnabled) {
559-
if (mWifiInfo == null) {
560-
if (DBG) logd("Ignoring link verification, mWifiInfo is NULL");
559+
if (mWifiInfo == null || mCurrentBssid == null) {
560+
loge("Ignore, wifiinfo " + mWifiInfo +" bssid " + mCurrentBssid);
561561
sendLinkStatusNotification(true);
562562
} else {
563563
transitionTo(mVerifyingLinkState);
@@ -726,7 +726,7 @@ public void enter() {
726726
}
727727

728728
private void handleRssiChange() {
729-
if (mCurrentSignalLevel <= LINK_MONITOR_LEVEL_THRESHOLD) {
729+
if (mCurrentSignalLevel <= LINK_MONITOR_LEVEL_THRESHOLD && mCurrentBssid != null) {
730730
transitionTo(mLinkMonitoringState);
731731
} else {
732732
// stay here
@@ -920,11 +920,15 @@ private void sendLinkStatusNotification(boolean isGood) {
920920
if (DBG) logd("########################################");
921921
if (isGood) {
922922
mWsmChannel.sendMessage(GOOD_LINK_DETECTED);
923-
mCurrentBssid.mLastTimeGood = SystemClock.elapsedRealtime();
924-
logd("Good link notification is sent");
923+
if (mCurrentBssid != null) {
924+
mCurrentBssid.mLastTimeGood = SystemClock.elapsedRealtime();
925+
}
926+
if (DBG) logd("Good link notification is sent");
925927
} else {
926928
mWsmChannel.sendMessage(POOR_LINK_DETECTED);
927-
mCurrentBssid.mLastTimePoor = SystemClock.elapsedRealtime();
929+
if (mCurrentBssid != null) {
930+
mCurrentBssid.mLastTimePoor = SystemClock.elapsedRealtime();
931+
}
928932
logd("Poor link notification is sent");
929933
}
930934
}

0 commit comments

Comments
 (0)