diff options
author | Adnan Begovic <adnan@cyngn.com> | 2016-01-08 14:03:21 -0800 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2017-01-07 01:41:45 +0200 |
commit | 8eb8b8c4107a0b09087864428600be6c63c00670 (patch) | |
tree | 6b0316e739c5c2423c6829137332b0de36eb18a0 | |
parent | eaf228dbc631547ba5f85cc0a81cb0e439560e26 (diff) | |
download | android_frameworks_opt_telephony-8eb8b8c4107a0b09087864428600be6c63c00670.tar.gz android_frameworks_opt_telephony-8eb8b8c4107a0b09087864428600be6c63c00670.tar.bz2 android_frameworks_opt_telephony-8eb8b8c4107a0b09087864428600be6c63c00670.zip |
telephony: Override nw mode on creation and when trying to calculate nw type.
Change-Id: Ic97ade9486c2af8fb2ecbbdcba0eb58f69a3c925
-rw-r--r-- | src/java/com/android/internal/telephony/PhoneFactory.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/java/com/android/internal/telephony/PhoneFactory.java b/src/java/com/android/internal/telephony/PhoneFactory.java index 29e6ac281..7db20efaf 100644 --- a/src/java/com/android/internal/telephony/PhoneFactory.java +++ b/src/java/com/android/internal/telephony/PhoneFactory.java @@ -235,6 +235,13 @@ public class PhoneFactory { // because ImsService might need it when it is being opened. for (int i = 0; i < numPhones; i++) { sPhones[i].startMonitoringImsService(); + // Get users NW type, let it override if its not the default NW mode (-1) + int userNwType = SubscriptionController.getInstance().getUserNwMode( + sPhones[i].getSubId()); + if (userNwType != SubscriptionManager.DEFAULT_NW_MODE + && userNwType != networkModes[i]) { + sPhones[i].setPreferredNetworkType(userNwType, null); + } } ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface( @@ -337,6 +344,14 @@ public class PhoneFactory { int networkType = android.provider.Settings.Global.getInt(context.getContentResolver(), android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId, RILConstants.PREFERRED_NETWORK_MODE); + + // 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; + } Rlog.d(LOG_TAG, "calculatePreferredNetworkType: phoneSubId = " + phoneSubId + " networkType = " + networkType); return networkType; |