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

Commit a927f53f authored by Nathan Harold's avatar Nathan Harold Committed by android-build-merger
Browse files

[RadioInfo] Save PreferredNetworkMode to Settings am: daea8be9

am: 1701aaf1

Change-Id: Ic2e685fa8076d0ac1255d3bf61b49c70f1d1767f
parents c0cadf4f 1701aaf1
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settings;

import static android.net.ConnectivityManager.NetworkCallback;
import static android.provider.Settings.Global.PREFERRED_NETWORK_MODE;

import android.app.Activity;
import android.app.AlertDialog;
@@ -39,6 +40,7 @@ import android.os.AsyncResult;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
import android.telephony.CarrierConfigManager;
import android.telephony.CellInfo;
import android.telephony.CellInfoCdma;
@@ -1451,6 +1453,19 @@ public class RadioInfo extends Activity {
            if (mPreferredNetworkTypeResult != pos && pos >= 0
                    && pos <= mPreferredNetworkLabels.length - 2) {
                mPreferredNetworkTypeResult = pos;

                // TODO: Possibly migrate this to TelephonyManager.setPreferredNetworkType()
                // which today still has some issues (mostly that the "set" is conditional
                // on a successful modem call, which is not what we want). Instead we always
                // want this setting to be set, so that if the radio hiccups and this setting
                // is for some reason unsuccessful, future calls to the radio will reflect
                // the users's preference which is set here.
                final int subId = phone.getSubId();
                if (SubscriptionManager.isUsableSubIdValue(subId)) {
                    Settings.Global.putInt(phone.getContext().getContentResolver(),
                            PREFERRED_NETWORK_MODE + subId, mPreferredNetworkTypeResult);
                }
                log("Calling setPreferredNetworkType(" + mPreferredNetworkTypeResult + ")");
                Message msg = mHandler.obtainMessage(EVENT_SET_PREFERRED_TYPE_DONE);
                phone.setPreferredNetworkType(mPreferredNetworkTypeResult, msg);
            }