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

Commit 281485c4 authored by Meng Wang's avatar Meng Wang Committed by Gerrit Code Review
Browse files

Merge "Defend against invalid subId in setPhoneNumberForSourceIms"

parents 91505c46 3f030395
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.