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

Commit 3f030395 authored by Meng Wang's avatar Meng Wang
Browse files

Defend against invalid subId in setPhoneNumberForSourceIms

Bug: 219080264
Test: manual smoke test
Change-Id: Ia97095b3d187f8e4fa8ea668540b3595a4328140
parent 399ee834
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.