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

Commit fd415214 authored by calvinpan's avatar calvinpan Committed by android-build-merger
Browse files

Merge "Redesign the setPreferredNetworkType"

am: 126623b9

Change-Id: I8af1e3c7844b258cc3b64e7f950cf648bc83b3b4
parents 7ac49235 126623b9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2670,6 +2670,9 @@ public class SubscriptionController extends ISub.Stub {
            case SubscriptionManager.WFC_IMS_ROAMING_ENABLED:
                value.put(propKey, Integer.parseInt(propValue));
                break;
            case SubscriptionManager.ALLOWED_NETWORK_TYPES:
                value.put(propKey, Long.parseLong(propValue));
                break;
            default:
                if (DBG) logd("Invalid column name");
                break;
@@ -2739,6 +2742,7 @@ public class SubscriptionController extends ISub.Stub {
                        case SubscriptionManager.IS_OPPORTUNISTIC:
                        case SubscriptionManager.GROUP_UUID:
                        case SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES:
                        case SubscriptionManager.ALLOWED_NETWORK_TYPES:
                            resultValue = cursor.getString(0);
                            break;
                        default:
+14 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ import android.service.euicc.EuiccProfileInfo;
import android.service.euicc.EuiccService;
import android.service.euicc.GetEuiccProfileInfoListResult;
import android.telephony.CarrierConfigManager;
import android.telephony.Rlog;
import android.telephony.RadioAccessFamily;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -55,6 +55,7 @@ import android.telephony.euicc.EuiccManager;
import android.text.TextUtils;
import android.util.Pair;

import com.android.telephony.Rlog;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.euicc.EuiccController;
import com.android.internal.telephony.metrics.TelephonyMetrics;
@@ -556,6 +557,18 @@ public class SubscriptionInfoUpdater extends Handler {
                    }

                    // Set the modem network mode
                    long allowedNetworkTypes = -1;
                    try {
                        allowedNetworkTypes = Long.parseLong(
                                SubscriptionController.getInstance().getSubscriptionProperty(subId,
                                        SubscriptionManager.ALLOWED_NETWORK_TYPES));
                    } catch (NumberFormatException err) {
                        logd("NumberFormat exception");
                    }

                    long networkTypeBitMask = RadioAccessFamily.getRafFromNetworkType(networkType);
                    networkType = RadioAccessFamily.getNetworkTypeFromRaf(
                            (int) (networkTypeBitMask & allowedNetworkTypes));
                    PhoneFactory.getPhone(phoneId).setPreferredNetworkType(networkType, null);

                    // Only support automatic selection mode on SIM change.