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

Commit abf1532b authored by Meng Wang's avatar Meng Wang Committed by Automerger Merge Worker
Browse files

Merge "Defend against invalid subId in setPhoneNumberForSourceIms" am: 281485c4 am: 87b015d6

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1983928

Change-Id: Ib696970a598e2126c6b3a47fc15cac3b7ea05566
parents fb8326f4 87b015d6
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2507,8 +2507,15 @@ public class ImsPhone extends ImsPhoneBase {
        if (phoneNumber == null) {
            return;
        }
        SubscriptionController subController = SubscriptionController.getInstance();
        int subId = getSubId();
        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
            // Defending b/219080264:
            // SubscriptionController.setSubscriptionProperty validates input subId
            // so do not proceed if subId invalid. This may be happening because cached
            // IMS callbacks are sent back to telephony after SIM state changed.
            return;
        }
        SubscriptionController subController = SubscriptionController.getInstance();
        String countryIso = getCountryIso(subController, subId);
        // Format the number as one more defense to reject garbage values:
        // phoneNumber will become null.