Do not update RAF for invalid sub IDs.
Etan Cohen [Tue, 21 Jul 2015 19:50:49 +0000 (12:50 -0700)]
Bug: 22076899
Change-Id: I44c6744d6464d13a0803a6480ee72f07bda7c087

src/java/com/android/internal/telephony/ProxyController.java
src/java/com/android/internal/telephony/SubscriptionController.java

index 2773760..0b84800 100644 (file)
@@ -618,7 +618,6 @@ public class ProxyController {
         int maxNumRafBit = 0;
         int maxRaf = RadioAccessFamily.RAF_UNKNOWN;
 
-        int number;
         for (int len = 0; len < mProxyPhones.length; len++) {
             numRafSupported[len] = Integer.bitCount(mProxyPhones[len].getRadioAccessFamily());
             if (maxNumRafBit < numRafSupported[len]) {
@@ -637,7 +636,6 @@ public class ProxyController {
         int minNumRafBit = 0;
         int minRaf = RadioAccessFamily.RAF_UNKNOWN;
 
-        int number;
         for (int len = 0; len < mProxyPhones.length; len++) {
             numRafSupported[len] = Integer.bitCount(mProxyPhones[len].getRadioAccessFamily());
             if ((minNumRafBit == 0) || (minNumRafBit > numRafSupported[len])) {
index 49b9b17..96b6393 100644 (file)
@@ -1414,6 +1414,7 @@ public class SubscriptionController extends ISub.Stub {
         if (SubscriptionManager.isValidSubscriptionId(subId)) {
             // Only re-map modems if the new default data sub is valid
             RadioAccessFamily[] rafs = new RadioAccessFamily[len];
+            boolean atLeastOneMatch = false;
             for (int phoneId = 0; phoneId < len; phoneId++) {
                 PhoneProxy phone = sProxyPhones[phoneId];
                 int raf;
@@ -1421,6 +1422,7 @@ public class SubscriptionController extends ISub.Stub {
                 if (id == subId) {
                     // TODO Handle the general case of N modems and M subscriptions.
                     raf = proxyController.getMaxRafSupported();
+                    atLeastOneMatch = true;
                 } else {
                     // TODO Handle the general case of N modems and M subscriptions.
                     raf = proxyController.getMinRafSupported();
@@ -1428,7 +1430,11 @@ public class SubscriptionController extends ISub.Stub {
                 logdl("[setDefaultDataSubId] phoneId=" + phoneId + " subId=" + id + " RAF=" + raf);
                 rafs[phoneId] = new RadioAccessFamily(phoneId, raf);
             }
-            proxyController.setRadioCapability(rafs);
+            if (atLeastOneMatch) {
+                proxyController.setRadioCapability(rafs);
+            } else {
+                if (DBG) logdl("[setDefaultDataSubId] no valid subId's found - not updating.");
+            }
         }
 
         // FIXME is this still needed?