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

Commit 62be2c7c 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
Change-Id: Ib62dd6cdf0d547e6f990bbdfb00e82698dc47794
parent 6dcb30cc
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -3779,11 +3779,16 @@ public class SubscriptionController extends ISub.Stub {
        final long token = Binder.clearCallingIdentity();

        try {
            int subId = PhoneSwitcher.getInstance().getActiveDataSubId();
            if (!SubscriptionManager.isUsableSubscriptionId(subId)) {
                subId = getDefaultDataSubId();
            PhoneSwitcher phoneSwitcher = PhoneSwitcher.getInstance();
            if (phoneSwitcher != null) {
                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 {
            Binder.restoreCallingIdentity(token);
        }