Fix for CMAS is not turned on
xinhe [Tue, 30 Sep 2014 22:05:05 +0000 (15:05 -0700)]
CMAS is not turned on for several reasons:
(1) Exception happends when default SMS sub Id is not available.
(2) Cellbroadcast thread can die before the servicestate change triggered

Bug:17571958
Change-Id: I7b210226fa24f266896763ff80235c4ed4b936eb

src/java/com/android/internal/telephony/UiccSmsController.java

index 591ef05..287aade 100755 (executable)
@@ -296,7 +296,13 @@ public class UiccSmsController extends ISms.Stub {
      * get sms interface manager object based on subscription.
      **/
     private IccSmsInterfaceManager getIccSmsInterfaceManager(long subId) {
-        long phoneId = SubscriptionController.getInstance().getPhoneId(subId);
+        int phoneId = SubscriptionController.getInstance().getPhoneId(subId) ;
+        //Fixme: for multi-subscription case
+        if (!SubscriptionManager.isValidPhoneId(phoneId)
+                || phoneId == SubscriptionManager.DEFAULT_PHONE_ID) {
+            phoneId = 0;
+        }
+
         try {
             return (IccSmsInterfaceManager)
                 ((PhoneProxy)mPhone[(int)phoneId]).getIccSmsInterfaceManager();