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

Commit 200d3e76 authored by yinxu's avatar yinxu
Browse files

Do not clear the existing no calling states

The no calling & SMS won't be updated frequently, so when new
subscriptions are added, we should keep the no calling & SMS states of
the old subscriptions.

Bug: 176429596
Test: unit tests, manual tests
Change-Id: I230f75c4eb3b0484a18cff4f3ba53364399370e1
parent d39f71e4
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -314,13 +314,25 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba

        mIconController.removeAllIconsForSlot(mSlotMobile);
        mMobileStates.clear();
        List<NoCallingIconState> noCallingStates = new ArrayList<NoCallingIconState>();
        noCallingStates.addAll(mNoCallingStates);
        mNoCallingStates.clear();
        final int n = subs.size();
        for (int i = 0; i < n; i++) {
            mMobileStates.add(new MobileIconState(subs.get(i).getSubscriptionId()));
            boolean isNewSub = true;
            for (NoCallingIconState state : noCallingStates) {
                if (state.subId == subs.get(i).getSubscriptionId()) {
                    mNoCallingStates.add(state);
                    isNewSub = false;
                    break;
                }
            }
            if (isNewSub) {
                mNoCallingStates.add(new NoCallingIconState(subs.get(i).getSubscriptionId()));
            }
        }
    }

    private boolean hasCorrectSubs(List<SubscriptionInfo> subs) {
        final int N = subs.size();