Fix Wifi state not updated while connecting

Wifi no longer updates ConnectivityService
regarding Wifi state during a connection,
so calling ConnectivityManager#getNetworkInfo
returns an invalid state. Instead, simply call
updateNetworkInfo(null), which will reuse the
last NetworkInfo object, while updating the RSSI
values.

Bug: 150188453
Test: verified in SUW
Change-Id: I0c5ebd8ebc07030e128ae913d81dbf56489239a2
This commit is contained in:
David Su
2020-06-08 22:31:51 -07:00
parent 06174db579
commit 60a78b7cb9

View File

@@ -900,9 +900,7 @@ public class WifiTracker implements LifecycleObserver, OnStart, OnStop, OnDestro
updateNetworkInfo(info);
fetchScansAndConfigsAndUpdateAccessPoints();
} else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) {
NetworkInfo info =
mConnectivityManager.getNetworkInfo(mWifiManager.getCurrentNetwork());
updateNetworkInfo(info);
updateNetworkInfo(/* networkInfo= */ null);
}
}
};
@@ -948,7 +946,7 @@ public class WifiTracker implements LifecycleObserver, OnStart, OnStop, OnDestro
// We don't send a NetworkInfo object along with this message, because even if we
// fetch one from ConnectivityManager, it might be older than the most recent
// NetworkInfo message we got via a WIFI_STATE_CHANGED broadcast.
updateNetworkInfo(null);
updateNetworkInfo(/* networkInfo= */ null);
}
}
}