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

Commit 17f2f414 authored by Pengquan Meng's avatar Pengquan Meng Committed by Android (Google) Code Review
Browse files

Merge "MSIM: Default NW mode property for each slot" into pi-dev

parents d70c066a bc571d25
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -330,9 +330,22 @@ public class PhoneFactory {
    public static int calculatePreferredNetworkType(Context context, int phoneSubId) {
        int networkType = android.provider.Settings.Global.getInt(context.getContentResolver(),
                android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                RILConstants.PREFERRED_NETWORK_MODE);
                -1 /* invalid network mode */);
        Rlog.d(LOG_TAG, "calculatePreferredNetworkType: phoneSubId = " + phoneSubId +
                " networkType = " + networkType);

        if (networkType == -1) {
            networkType = RILConstants.PREFERRED_NETWORK_MODE;
            try {
                networkType = TelephonyManager.getIntAtIndex(context.getContentResolver(),
                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
                        SubscriptionController.getInstance().getPhoneId(phoneSubId));
            } catch (SettingNotFoundException retrySnfe) {
                Rlog.e(LOG_TAG, "Settings Exception Reading Value At Index for "
                        + "Settings.Global.PREFERRED_NETWORK_MODE");
            }
        }

        return networkType;
    }

+9 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.os.ServiceManager;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.provider.Settings.SettingNotFoundException;
import android.service.euicc.EuiccProfileInfo;
import android.service.euicc.EuiccService;
import android.service.euicc.GetEuiccProfileInfoListResult;
@@ -464,6 +465,14 @@ public class SubscriptionInfoUpdater extends Handler {

                    if (networkType == -1) {
                        networkType = RILConstants.PREFERRED_NETWORK_MODE;
                        try {
                            networkType = TelephonyManager.getIntAtIndex(
                                    mContext.getContentResolver(),
                                    Settings.Global.PREFERRED_NETWORK_MODE, slotId);
                        } catch (SettingNotFoundException retrySnfe) {
                            Rlog.e(LOG_TAG, "Settings Exception Reading Value At Index for "
                                    + "Settings.Global.PREFERRED_NETWORK_MODE");
                        }
                        Settings.Global.putInt(
                                mPhone[slotId].getContext().getContentResolver(),
                                Global.PREFERRED_NETWORK_MODE + subId,