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

Commit 54f645f2 authored by Adnan Begovic's avatar Adnan Begovic Committed by Gerrit Code Review
Browse files

telephony: Override nw mode on creation and when trying to calculate nw type.

Change-Id: Ic97ade9486c2af8fb2ecbbdcba0eb58f69a3c925
parent fd6eb59d
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -233,6 +233,13 @@ public class PhoneFactory {
                // because ImsService might need it when it is being opened.
                // because ImsService might need it when it is being opened.
                for (int i = 0; i < numPhones; i++) {
                for (int i = 0; i < numPhones; i++) {
                    sProxyPhones[i].startMonitoringImsService();
                    sProxyPhones[i].startMonitoringImsService();
                    // Get users NW type, let it override if its not the default NW mode (-1)
                    int userNwType = SubscriptionController.getInstance().getUserNwMode(
                            sProxyPhones[i].getSubId());
                    if (userNwType != SubscriptionManager.DEFAULT_NW_MODE
                            && userNwType != networkModes[i]) {
                        sProxyPhones[i].setPreferredNetworkType(userNwType, null);
                    }
                }
                }
            }
            }
        }
        }
@@ -370,6 +377,14 @@ public class PhoneFactory {
            networkType = android.provider.Settings.Global.getInt(context.getContentResolver(),
            networkType = android.provider.Settings.Global.getInt(context.getContentResolver(),
                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                    phoneIdNetworkType);
                    phoneIdNetworkType);

            // Get users NW type, let it override if its not the default NW mode (-1)
            int userNwType = SubscriptionController.getInstance().getUserNwMode(phoneSubId);
            if (userNwType != SubscriptionManager.DEFAULT_NW_MODE && userNwType != networkType) {
                Rlog.d(LOG_TAG, "calculatePreferredNetworkType: overriding for usernw mode " +
                        "phoneSubId = " + phoneSubId + " networkType = " + networkType);
                networkType = userNwType;
            }
        } else {
        } else {
            Rlog.d(LOG_TAG, "calculatePreferredNetworkType: phoneSubId = " + phoneSubId +
            Rlog.d(LOG_TAG, "calculatePreferredNetworkType: phoneSubId = " + phoneSubId +
                    " is not a active SubId");
                    " is not a active SubId");