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

Commit c7fa6598 authored by Ruthwar Kumar Ambeer's avatar Ruthwar Kumar Ambeer Committed by Steve Kondik
Browse files

Update preferred network type based on active Sub ID

On subInfo changed, Network type need not to be
updated if SUB is not active or dummy.

Keep the phone id based network type in sync with
Sub ID based network type always.

Change-Id: Idaa9da264321307f3f757f086b171f7e783a229a
parent 3db37b5a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1123,7 +1123,7 @@ public abstract class PhoneBase extends Handler implements Phone {

    private void updateSavedNetworkOperator(NetworkSelectMessage nsm) {
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
        if (SubscriptionController.getInstance().isActiveSubId(subId)) {
            // open the shared preferences editor, and write the value.
            // nsm.operatorNumeric is "" if we're in automatic.selection.
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
@@ -2689,7 +2689,7 @@ public abstract class PhoneBase extends Handler implements Phone {
        // Update the cached value
        mRadioCapability.set(rc);

        if (SubscriptionManager.isValidSubscriptionId(getSubId())) {
        if (SubscriptionController.getInstance().isActiveSubId(getSubId())) {
            updatePreferredType();
            sendSubscriptionSettings(true);
        }
@@ -2719,7 +2719,7 @@ public abstract class PhoneBase extends Handler implements Phone {

    protected void setPreferredNetworkTypeIfSimLoaded() {
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
        if (SubscriptionController.getInstance().isActiveSubId(subId)) {
            int type = PhoneFactory.calculatePreferredNetworkType(mContext, getSubId());
            setPreferredNetworkType(type, null);
        }
+7 −0
Original line number Diff line number Diff line
@@ -385,6 +385,13 @@ public class PhoneFactory {
                        "phoneSubId = " + phoneSubId + " networkType = " + networkType);
                networkType = userNwType;
            }

            //Update phone id based network type with Sub ID based.
            if (networkType != phoneIdNetworkType) {
                TelephonyManager.putIntAtIndex(context.getContentResolver(),
                        Settings.Global.PREFERRED_NETWORK_MODE, phoneId,
                        networkType);
            }
        } else {
            Rlog.d(LOG_TAG, "calculatePreferredNetworkType: phoneSubId = " + phoneSubId +
                    " is not a active SubId");
+1 −1
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ public abstract class ServiceStateTracker extends Handler {
            // Set the network type, in case the radio does not restore it.
            int subId = mPhoneBase.getSubId();
            if (mPreviousSubId.getAndSet(subId) != subId) {
                if (SubscriptionManager.isValidSubscriptionId(subId)) {
                if (mSubscriptionController.isActiveSubId(subId)) {
                    Context context = mPhoneBase.getContext();

                    mPhoneBase.notifyCallForwardingIndicator();