Merge "Fix Wi-Fi SSID null handling" am: cadd76044e

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1624059

Change-Id: I92537bac7a2762a74a1df051efa1600fdf381eeb
This commit is contained in:
Les Lee
2021-04-06 04:42:57 +00:00
committed by Automerger Merge Worker

View File

@@ -198,17 +198,13 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> {
final int oemManaged = getOemBitfield(snapshot.networkCapabilities);
if (legacyType == TYPE_WIFI) {
if (snapshot.networkCapabilities.getSsid() != null) {
networkId = snapshot.networkCapabilities.getSsid();
if (networkId == null) {
// TODO: Figure out if this code path never runs. If so, remove them.
final WifiManager wifi = (WifiManager) context.getSystemService(
Context.WIFI_SERVICE);
final WifiManager wifi = context.getSystemService(WifiManager.class);
final WifiInfo info = wifi.getConnectionInfo();
networkId = info != null ? info.getSSID() : null;
}
}
}
return new NetworkIdentity(legacyType, subType, subscriberId, networkId, roaming, metered,
defaultNetwork, oemManaged);