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

Commit 029e2d77 authored by Weng Su's avatar Weng Su
Browse files

Fix WiFi show "Not connected" always issue

- The WiFi summary is designed to be changed when the
onCapabilitiesChanged() callback is made from the ConnectivityManager,
but there is no guarantee that there will be a callback after the
settings are registered to the ConnectivityManager.

- Need to fatch initial state information to show the correct summary
first when the settings register callback to the ConnectivityManager.

- Screenshot:
  https://screenshot.googleplex.com/AwmLX2ZQE2grC7N

Bug: 179335681
Test: manual test
- make RunSettingsRoboTests ROBOTEST_FILTER=WifiSummaryUpdaterTest

Change-Id: Ib5d22bdf34a3832dd5082e6e11cee699694afdee
parent c01232b1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ public final class WifiSummaryUpdater extends SummaryUpdater {
    @Override
    public void register(boolean register) {
        if (register) {
            mWifiTracker.fetchInitialState();
            notifyChangeIfNeeded();
            mContext.registerReceiver(mReceiver, INTENT_FILTER);
        } else {
+8 −0
Original line number Diff line number Diff line
@@ -64,6 +64,14 @@ public class WifiSummaryUpdaterTest {
        verify(mWifiTracker).setListening(true);
    }

    @Test
    public void register_true_shouldFetchInitialStateAndSendSummaryChange() {
        mSummaryUpdater.register(true);

        verify(mWifiTracker).fetchInitialState();
        verify(mListener).onSummaryChanged(anyString());
    }

    @Test
    public void register_false_shouldUnregisterListenerAndTracker() {
        mSummaryUpdater.register(true);