Loading src/com/android/settings/wifi/NetworkRequestDialogFragment.java +17 −7 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ package com.android.settings.wifi; import static com.android.wifitrackerlib.Utils.getSecurityTypesFromScanResult; import static java.util.stream.Collectors.toList; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; Loading Loading @@ -273,19 +271,31 @@ public class NetworkRequestDialogFragment extends NetworkRequestDialogBaseFragme @VisibleForTesting void updateWifiEntries() { final List<WifiEntry> wifiEntries = new ArrayList<>(); if (mWifiPickerTracker.getConnectedWifiEntry() != null) { wifiEntries.add(mWifiPickerTracker.getConnectedWifiEntry()); WifiEntry connectedWifiEntry = mWifiPickerTracker.getConnectedWifiEntry(); String connectedSsid; if (connectedWifiEntry != null) { connectedSsid = connectedWifiEntry.getSsid(); wifiEntries.add(connectedWifiEntry); } else { connectedSsid = null; } wifiEntries.addAll(mWifiPickerTracker.getWifiEntries()); mFilteredWifiEntries.clear(); mFilteredWifiEntries.addAll(wifiEntries.stream() .filter(entry -> isMatchedWifiEntry(entry)) .filter(entry -> isMatchedWifiEntry(entry, connectedSsid)) .limit(mShowLimitedItem ? MAX_NUMBER_LIST_ITEM : Long.MAX_VALUE) .collect(toList())); .toList()); } private boolean isMatchedWifiEntry(WifiEntry entry) { private boolean isMatchedWifiEntry(WifiEntry entry, String connectedSsid) { if (entry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED && TextUtils.equals(entry.getSsid(), connectedSsid)) { // WifiPickerTracker may return a duplicate unsaved network that is separate from // the connecting app-requested network, so make sure we only show the connected // app-requested one. return false; } for (MatchWifi wifi : mMatchWifis) { if (!TextUtils.equals(entry.getSsid(), wifi.mSsid)) { continue; Loading Loading
src/com/android/settings/wifi/NetworkRequestDialogFragment.java +17 −7 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ package com.android.settings.wifi; import static com.android.wifitrackerlib.Utils.getSecurityTypesFromScanResult; import static java.util.stream.Collectors.toList; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; Loading Loading @@ -273,19 +271,31 @@ public class NetworkRequestDialogFragment extends NetworkRequestDialogBaseFragme @VisibleForTesting void updateWifiEntries() { final List<WifiEntry> wifiEntries = new ArrayList<>(); if (mWifiPickerTracker.getConnectedWifiEntry() != null) { wifiEntries.add(mWifiPickerTracker.getConnectedWifiEntry()); WifiEntry connectedWifiEntry = mWifiPickerTracker.getConnectedWifiEntry(); String connectedSsid; if (connectedWifiEntry != null) { connectedSsid = connectedWifiEntry.getSsid(); wifiEntries.add(connectedWifiEntry); } else { connectedSsid = null; } wifiEntries.addAll(mWifiPickerTracker.getWifiEntries()); mFilteredWifiEntries.clear(); mFilteredWifiEntries.addAll(wifiEntries.stream() .filter(entry -> isMatchedWifiEntry(entry)) .filter(entry -> isMatchedWifiEntry(entry, connectedSsid)) .limit(mShowLimitedItem ? MAX_NUMBER_LIST_ITEM : Long.MAX_VALUE) .collect(toList())); .toList()); } private boolean isMatchedWifiEntry(WifiEntry entry) { private boolean isMatchedWifiEntry(WifiEntry entry, String connectedSsid) { if (entry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED && TextUtils.equals(entry.getSsid(), connectedSsid)) { // WifiPickerTracker may return a duplicate unsaved network that is separate from // the connecting app-requested network, so make sure we only show the connected // app-requested one. return false; } for (MatchWifi wifi : mMatchWifis) { if (!TextUtils.equals(entry.getSsid(), wifi.mSsid)) { continue; Loading