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

Commit 79562319 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed crash in getActiveDataSubscriptionId

Fixed by adding null check. If phone switcher is not ready,
use default data sub id from settings.

Bug: 135059959
Test: Manual

Merged-In: Ib62dd6cdf0d547e6f990bbdfb00e82698dc47794
Change-Id: Ib62dd6cdf0d547e6f990bbdfb00e82698dc47794
(cherry picked from commit 62be2c7c)
parent e16f6060
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -3696,11 +3696,16 @@ public class SubscriptionController extends ISub.Stub {
        final long token = Binder.clearCallingIdentity();
        final long token = Binder.clearCallingIdentity();


        try {
        try {
            int subId = PhoneSwitcher.getInstance().getActiveDataSubId();
            PhoneSwitcher phoneSwitcher = PhoneSwitcher.getInstance();
            if (!SubscriptionManager.isUsableSubscriptionId(subId)) {
            if (phoneSwitcher != null) {
                subId = getDefaultDataSubId();
                int activeDataSubId = phoneSwitcher.getActiveDataSubId();
                if (SubscriptionManager.isUsableSubscriptionId(activeDataSubId)) {
                    return activeDataSubId;
                }
                }
            return subId;
            }
            // If phone switcher isn't ready, or active data sub id is not available, use default
            // sub id from settings.
            return getDefaultDataSubId();
        } finally {
        } finally {
            Binder.restoreCallingIdentity(token);
            Binder.restoreCallingIdentity(token);
        }
        }