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

Commit b00a001d authored by Sandeep Gutta's avatar Sandeep Gutta Committed by Gerrit - the friendly Code Review server
Browse files

Telephony(MSIM): Store defaultSubId in shared pref

Add support to store default subId value in
shared preference to retain the value in next boots.

Change-Id: I57f233adaaab09c956f5b4ab3866638fa84eb78d
CRs-Fixed: 764061
parent 8a0b898e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1143,7 +1143,8 @@ public class SubscriptionController extends ISub.Stub {
    @Deprecated
    public long getDefaultSubId() {
        //FIXME: Make this smarter, need to handle data only and voice devices
        long subId = mDefaultVoiceSubId;
        long subId = Settings.Global.getLong(mContext.getContentResolver(),
                 Settings.Global.MULTI_SIM_DEFAULT_SUBSCRIPTION, DUMMY_SUB_ID);
        if (VDBG) logv("[getDefaultSubId] value = " + subId);
        return subId;
    }
@@ -1317,6 +1318,8 @@ public class SubscriptionController extends ISub.Stub {
                    || TelephonyManager.getDefault().getSimCount() == 1)) {
                logdl("[setDefaultSubId] set mDefaultVoiceSubId=" + subId);
                mDefaultVoiceSubId = subId;
                Settings.Global.putLong(mContext.getContentResolver(),
                         Settings.Global.MULTI_SIM_DEFAULT_SUBSCRIPTION, subId);
                // Update MCC MNC device configuration information
                String defaultMccMnc = TelephonyManager.getDefault().getSimOperator(phoneId);
                MccTable.updateMccMncConfiguration(mContext, defaultMccMnc, false);
@@ -1659,6 +1662,7 @@ public class SubscriptionController extends ISub.Stub {
        //if there are no activated subs available, no need to update. EXIT.
        if (mNextActivatedSub == null) return;

        //if current default sub is not active, fallback to next active sub.
        if (getSubState(getDefaultSubId()) == SubscriptionManager.INACTIVE) {
            setDefaultSubId(mNextActivatedSub.subId);
        }