Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38a8287a authored by Quang Luong's avatar Quang Luong
Browse files

Use WifiPickerTracker to get connected WifiEntry

Use WifiPickerTracker.getConnectedWifiEntry API to get a WifiEntry to
display at the top of the Wifi picker as the connected network.

Test: manual - visual verification of connected entry at the top of the
wifi picker.
Bug: 70983952

Change-Id: Iec6e1c9fe950397f62350194d8b24791a7eac30a
parent e49ff7de
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -486,6 +486,22 @@ public class WifiSettings2 extends RestrictedSettingsFragment
        mConnectedWifiEntryPreferenceCategory.setVisible(true);
        mWifiEntryPreferenceCategory.setVisible(true);

        final WifiEntry connectedEntry = mWifiPickerTracker.getConnectedWifiEntry();
        if (connectedEntry != null) {
            final LongPressWifiEntryPreference connectedPref =
                    mConnectedWifiEntryPreferenceCategory.findPreference(connectedEntry.getKey());
            if (connectedPref == null || connectedPref.getWifiEntry() != connectedEntry) {
                mConnectedWifiEntryPreferenceCategory.removeAll();
                final LongPressWifiEntryPreference pref =
                        createLongPressWifiEntryPreference(connectedEntry);
                pref.setKey(connectedEntry.getKey());
                pref.refresh();
                mConnectedWifiEntryPreferenceCategory.addPreference(pref);
            }
        } else {
            mConnectedWifiEntryPreferenceCategory.removeAll();
        }

        int index = 0;
        cacheRemoveAllPrefs(mWifiEntryPreferenceCategory);
        List<WifiEntry> wifiEntries = mWifiPickerTracker.getWifiEntries();