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

Commit dc4e37bf authored by Danny Baumann's avatar Danny Baumann
Browse files

Don't inflate new phone states on callbacks.

Due to the asynchronous nature of PhoneStateListeners, phone state
callbacks for dropped and unregistered mobile signal controllers might
come in even after unregistering. Don't make such callbacks create new
signal bar instances, but instead drop them.

Change-Id: I75afc0d283181208fea6a3699e2b95c0030ad6e2
parent aa8ad23f
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -169,7 +169,11 @@ public class SignalClusterView
            int activityIcon, int typeIcon, String contentDescription,
            String typeContentDescription, boolean isTypeIconWide,
            boolean showRoamingIndicator, int subId) {
        PhoneState state = getOrInflateState(subId);
        PhoneState state = getState(subId);
        if (state == null) {
            return;
        }

        state.mMobileVisible = visible;
        state.mMobileStrengthId = strengthIcon;
        state.mMobileActivityId = activityIcon;
@@ -200,13 +204,13 @@ public class SignalClusterView
        }
    }

    private PhoneState getOrInflateState(int subId) {
    private PhoneState getState(int subId) {
        for (PhoneState state : mPhoneStates) {
            if (state.mSubId == subId) {
                return state;
            }
        }
        return inflatePhoneState(subId);
        return null;
    }

    private PhoneState inflatePhoneState(int subId) {