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

Commit 2f70520f authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Make sure to obtain correct subId in carrier config change.

MultiSimSettingController sometimes receives carrier config chagne
without correct subId in it. While we debug the root cause, we add
an additional check to make sure we get the subId if missing.

Bug: 153860050
Test: unittest
Change-Id: I1dffd41fa373f0b29559c933cc8c5aaa1e3b2478
Merged-In: I1dffd41fa373f0b29559c933cc8c5aaa1e3b2478
parent 192d33cb
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -346,6 +346,22 @@ public class MultiSimSettingController extends Handler {
            return;
            return;
        }
        }


        // b/153860050 Occasionally we receive carrier config change broadcast without subId
        // being specified in it. So here we do additional check to make sur we don't miss the
        // subId.
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            int[] subIds = mSubController.getSubId(phoneId);
            if (!ArrayUtils.isEmpty(subIds)) {
                CarrierConfigManager cm = (CarrierConfigManager) mContext.getSystemService(
                        mContext.CARRIER_CONFIG_SERVICE);
                if (cm != null && cm.getConfigForSubId(subIds[0]) != null) {
                    loge("onCarrierConfigChanged with invalid subId while subd "
                            + subIds[0] + " is active and its config is loaded");
                    subId = subIds[0];
                }
            }
        }

        mCarrierConfigLoadedSubIds[phoneId] = subId;
        mCarrierConfigLoadedSubIds[phoneId] = subId;
        reEvaluateAll();
        reEvaluateAll();
    }
    }
+2 −0
Original line number Original line Diff line number Diff line
@@ -356,6 +356,8 @@ public class SubscriptionInfoUpdater extends Handler {


            case EVENT_MULTI_SIM_CONFIG_CHANGED:
            case EVENT_MULTI_SIM_CONFIG_CHANGED:
                onMultiSimConfigChanged();
                onMultiSimConfigChanged();
                break;

            default:
            default:
                logd("Unknown msg:" + msg.what);
                logd("Unknown msg:" + msg.what);
        }
        }