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

Commit f535cf04 authored by Jason Monk's avatar Jason Monk
Browse files

Don't reinflate signal icons unless we really need to.

Bug: 21791609
Change-Id: I5eb1b890f2298211b25afa0e2570f0ab49a45e0b
parent f858f703
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -251,6 +251,9 @@ public class SignalClusterView

    @Override
    public void setSubs(List<SubscriptionInfo> subs) {
        if (hasCorrectSubs(subs)) {
            return;
        }
        // Clear out all old subIds.
        mPhoneStates.clear();
        if (mMobileSignalGroup != null) {
@@ -265,6 +268,19 @@ public class SignalClusterView
        }
    }

    private boolean hasCorrectSubs(List<SubscriptionInfo> subs) {
        final int N = subs.size();
        if (N != mPhoneStates.size()) {
            return false;
        }
        for (int i = 0; i < N; i++) {
            if (mPhoneStates.get(i).mSubId != subs.get(i).getSubscriptionId()) {
                return false;
            }
        }
        return true;
    }

    private PhoneState getOrInflateState(int subId) {
        for (PhoneState state : mPhoneStates) {
            if (state.mSubId == subId) {