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

Commit cc72a697 authored by Kent Persson's avatar Kent Persson Committed by Steve Kondik
Browse files

UI not updated correctly in expanded statusbar

Sometimes when getting status changes in expanded statusbar the
text disappear. Both NetworkController and PhoneStatusBar handles
UI updates and they are not in sync. This fix allows PhoneStatusBar
to update UI when NetworkController is updating the UI.

Change-Id: I46b8a24ecc732e441f836692c6584a78d8108dff
parent a64c428d
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -121,7 +121,8 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;

public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        NetworkController.UpdateUIListener {
    static final String TAG = "PhoneStatusBar";
    public static final boolean DEBUG = BaseStatusBar.DEBUG;
    public static final boolean SPEW = false;
@@ -829,6 +830,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        // listen for USER_SETUP_COMPLETE setting (per-user)
        resetUserSetupObserver();

        mNetworkController.setListener(this);

        return mStatusBarView;
    }

@@ -1282,6 +1285,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        }
    }

    /**
     * Listen for UI updates and refresh layout.
     */
    public void onUpdateUI() {
        updateCarrierLabelVisibility(true);
    }

    protected void updateCarrierLabelVisibility(boolean force) {
        if (!mShowCarrierInPanel) return;
        // The idea here is to only show the carrier label when there is enough room to see it,
+18 −0
Original line number Diff line number Diff line
@@ -168,6 +168,8 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {

    boolean mDataAndWifiStacked = false;

    private UpdateUIListener mUpdateUIListener = null;

    public interface SignalCluster {
        void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon,
                String contentDescription);
@@ -1424,6 +1426,11 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
                v.setVisibility(View.VISIBLE);
            }
        }

        // Update the dependency UI
        if (mUpdateUIListener != null) {
            mUpdateUIListener.onUpdateUI();
        }
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
@@ -1655,4 +1662,15 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
            }
        }
    }

    /**
     * Let others listen for UI updates in NetworkController.
     */
    public static interface UpdateUIListener {
        void onUpdateUI();
    }

    public void setListener(UpdateUIListener listener) {
        mUpdateUIListener = listener;
    }
}