am f5820276: Merge "Don\'t reinflate signal icons unless we really need to." into mnc-dev

* commit 'f5820276635a2d3d2e3c694eddba7e6a02093a20':
  Don't reinflate signal icons unless we really need to.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index 9e0b08b..5a4acb4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -251,6 +251,9 @@
 
     @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 @@
         }
     }
 
+    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) {