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

Commit e7b0d386 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "MSIM: Update Default subId value"

parents b6e82646 6d196637
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -172,6 +172,11 @@ public class SubscriptionController extends ISub.Stub {
    private DdsScheduler mScheduler;
    private DdsSchedulerAc mSchedulerAc;

    // Dummy subId is used when no SIMs present on device
    // with MSIM configuration and this is corresponds
    // to phoneId 0.
    private static final int DUMMY_SUB_ID = -1;

    public static SubscriptionController init(Phone phone) {
        synchronized (SubscriptionController.class) {
            if (sInstance == null) {
@@ -1625,6 +1630,12 @@ public class SubscriptionController extends ISub.Stub {
            logd("updateUserPrefs: subscription are not avaiable dds = " + getDefaultDataSubId()
                     + " voice = " + getDefaultVoiceSubId() + " sms = " + getDefaultSmsSubId() +
                     " setDDs = " + setDds);
            // If no SIM cards present on device, set dummy subId
            // as data/sms/voice preferred subId.
            setDefaultSubId(DUMMY_SUB_ID);
            setDefaultVoiceSubId(DUMMY_SUB_ID);
            setDefaultSmsSubId(DUMMY_SUB_ID);
            setDataSubId(DUMMY_SUB_ID);
            return;
        }

@@ -1648,6 +1659,10 @@ public class SubscriptionController extends ISub.Stub {
        //if there are no activated subs available, no need to update. EXIT.
        if (mNextActivatedSub == null) return;

        if (getSubState(getDefaultSubId()) == SubscriptionManager.INACTIVE) {
            setDefaultSubId(mNextActivatedSub.subId);
        }

        long ddsSubId = getDefaultDataSubId();
        int ddsSubState = getSubState(ddsSubId);
        //if current data sub is not active, fallback to next active sub.