summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorLes Lee <lesl@google.com>2021-04-06 03:52:52 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-04-06 03:52:52 +0000
commitcadd76044e62aff775dd1324690d0c418e314378 (patch)
tree366f5a707c9a4f430c29d97a58a96a12126d83ae /core/java
parent7cd588e21046add2dfd178008f340426750eae54 (diff)
parent15d809b9f47530c739f7e1e205ab50d76f473a0b (diff)
Merge "Fix Wi-Fi SSID null handling"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/NetworkIdentity.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/core/java/android/net/NetworkIdentity.java b/core/java/android/net/NetworkIdentity.java
index b037261f0bc2..1eef7d9a5337 100644
--- a/core/java/android/net/NetworkIdentity.java
+++ b/core/java/android/net/NetworkIdentity.java
@@ -198,15 +198,11 @@ 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 WifiInfo info = wifi.getConnectionInfo();
- networkId = info != null ? info.getSSID() : null;
- }
+ networkId = snapshot.networkCapabilities.getSsid();
+ if (networkId == null) {
+ final WifiManager wifi = context.getSystemService(WifiManager.class);
+ final WifiInfo info = wifi.getConnectionInfo();
+ networkId = info != null ? info.getSSID() : null;
}
}