From 200d3e76654108b270a9624bc3a9f62f24cae8c6 Mon Sep 17 00:00:00 2001 From: yinxu Date: Thu, 28 Jan 2021 08:38:39 -0800 Subject: [PATCH] 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 --- .../statusbar/phone/StatusBarSignalPolicy.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java index d11e8641f987f..cb7d31cdf77c6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java @@ -314,11 +314,23 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba mIconController.removeAllIconsForSlot(mSlotMobile); mMobileStates.clear(); + List noCallingStates = new ArrayList(); + 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())); - mNoCallingStates.add(new NoCallingIconState(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())); + } } }