Loading src/java/com/android/internal/telephony/PhoneBase.java +17 −11 Original line number Diff line number Diff line Loading @@ -906,17 +906,23 @@ public abstract class PhoneBase extends Handler implements Phone { } private void updateSavedNetworkOperator(NetworkSelectMessage nsm) { int subId = getSubId(); if (SubscriptionManager.isValidSubscriptionId(subId)) { // open the shared preferences editor, and write the value. // nsm.operatorNumeric is "" if we're in automatic.selection. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences.Editor editor = sp.edit(); editor.putString(NETWORK_SELECTION_KEY, nsm.operatorNumeric); editor.putString(NETWORK_SELECTION_NAME_KEY, nsm.operatorAlphaLong); editor.putString(NETWORK_SELECTION_KEY + subId, nsm.operatorNumeric); editor.putString(NETWORK_SELECTION_NAME_KEY + subId, nsm.operatorAlphaLong); // commit and log the result. if (!editor.commit()) { Rlog.e(LOG_TAG, "failed to commit network selection preference"); } } else { Rlog.e(LOG_TAG, "Cannot update network selection preference due to invalid subId " + subId); } } /** Loading Loading @@ -946,7 +952,7 @@ public abstract class PhoneBase extends Handler implements Phone { private String getSavedNetworkSelection() { // open the shared preferences and search with our key. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); return sp.getString(NETWORK_SELECTION_KEY, ""); return sp.getString(NETWORK_SELECTION_KEY + getSubId(), ""); } /** Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +32 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OP import android.app.PendingIntent; import android.content.Context; import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; Loading @@ -28,6 +29,7 @@ import android.os.Registrant; import android.os.RegistrantList; import android.os.SystemClock; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.telephony.CellInfo; import android.telephony.Rlog; import android.telephony.ServiceState; Loading Loading @@ -251,12 +253,19 @@ public abstract class ServiceStateTracker extends Handler { if (previousSubId != subId) { previousSubId = subId; if (SubscriptionManager.isValidSubscriptionId(subId)) { int networkType = PhoneFactory.calculatePreferredNetworkType( mPhoneBase.getContext(), subId); Context context = mPhoneBase.getContext(); int networkType = PhoneFactory.calculatePreferredNetworkType(context, subId); mCi.setPreferredNetworkType(networkType, null); mPhoneBase.notifyCallForwardingIndicator(); boolean skipRestoringSelection = context.getResources().getBoolean( com.android.internal.R.bool.skip_restoring_network_selection); if (!skipRestoringSelection) { // restore the previous network selection. mPhoneBase.restoreSavedNetworkSelection(null); } mPhoneBase.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, ServiceState.rilRadioTechnologyToString(mSS.getRilDataRadioTechnology())); Loading @@ -265,6 +274,27 @@ public abstract class ServiceStateTracker extends Handler { mCurPlmn, mCurShowSpn, mCurSpn); mSpnUpdatePending = false; } // Remove old network selection sharedPreferences since SP key names are now // changed to include subId. This will be done only once when upgrading from an // older build that did not include subId in the names. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences( context); String oldNetworkSelectionName = sp.getString(PhoneBase. NETWORK_SELECTION_NAME_KEY, ""); String oldNetworkSelection = sp.getString(PhoneBase.NETWORK_SELECTION_KEY, ""); if (!TextUtils.isEmpty(oldNetworkSelectionName) || !TextUtils.isEmpty(oldNetworkSelection)) { SharedPreferences.Editor editor = sp.edit(); editor.putString(PhoneBase.NETWORK_SELECTION_NAME_KEY + subId, oldNetworkSelectionName); editor.putString(PhoneBase.NETWORK_SELECTION_KEY + subId, oldNetworkSelection); editor.remove(PhoneBase.NETWORK_SELECTION_NAME_KEY); editor.remove(PhoneBase.NETWORK_SELECTION_KEY); editor.commit(); } } } } Loading src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +0 −7 Original line number Diff line number Diff line Loading @@ -315,13 +315,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker { break; case EVENT_SIM_READY: boolean skipRestoringSelection = mPhone.getContext().getResources().getBoolean( com.android.internal.R.bool.skip_restoring_network_selection); if (!skipRestoringSelection) { // restore the previous network selection. mPhone.restoreSavedNetworkSelection(null); } pollState(); // Signal strength polling stops when radio is off queueNextSignalStrengthPoll(); Loading Loading
src/java/com/android/internal/telephony/PhoneBase.java +17 −11 Original line number Diff line number Diff line Loading @@ -906,17 +906,23 @@ public abstract class PhoneBase extends Handler implements Phone { } private void updateSavedNetworkOperator(NetworkSelectMessage nsm) { int subId = getSubId(); if (SubscriptionManager.isValidSubscriptionId(subId)) { // open the shared preferences editor, and write the value. // nsm.operatorNumeric is "" if we're in automatic.selection. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences.Editor editor = sp.edit(); editor.putString(NETWORK_SELECTION_KEY, nsm.operatorNumeric); editor.putString(NETWORK_SELECTION_NAME_KEY, nsm.operatorAlphaLong); editor.putString(NETWORK_SELECTION_KEY + subId, nsm.operatorNumeric); editor.putString(NETWORK_SELECTION_NAME_KEY + subId, nsm.operatorAlphaLong); // commit and log the result. if (!editor.commit()) { Rlog.e(LOG_TAG, "failed to commit network selection preference"); } } else { Rlog.e(LOG_TAG, "Cannot update network selection preference due to invalid subId " + subId); } } /** Loading Loading @@ -946,7 +952,7 @@ public abstract class PhoneBase extends Handler implements Phone { private String getSavedNetworkSelection() { // open the shared preferences and search with our key. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); return sp.getString(NETWORK_SELECTION_KEY, ""); return sp.getString(NETWORK_SELECTION_KEY + getSubId(), ""); } /** Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +32 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OP import android.app.PendingIntent; import android.content.Context; import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; Loading @@ -28,6 +29,7 @@ import android.os.Registrant; import android.os.RegistrantList; import android.os.SystemClock; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.telephony.CellInfo; import android.telephony.Rlog; import android.telephony.ServiceState; Loading Loading @@ -251,12 +253,19 @@ public abstract class ServiceStateTracker extends Handler { if (previousSubId != subId) { previousSubId = subId; if (SubscriptionManager.isValidSubscriptionId(subId)) { int networkType = PhoneFactory.calculatePreferredNetworkType( mPhoneBase.getContext(), subId); Context context = mPhoneBase.getContext(); int networkType = PhoneFactory.calculatePreferredNetworkType(context, subId); mCi.setPreferredNetworkType(networkType, null); mPhoneBase.notifyCallForwardingIndicator(); boolean skipRestoringSelection = context.getResources().getBoolean( com.android.internal.R.bool.skip_restoring_network_selection); if (!skipRestoringSelection) { // restore the previous network selection. mPhoneBase.restoreSavedNetworkSelection(null); } mPhoneBase.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, ServiceState.rilRadioTechnologyToString(mSS.getRilDataRadioTechnology())); Loading @@ -265,6 +274,27 @@ public abstract class ServiceStateTracker extends Handler { mCurPlmn, mCurShowSpn, mCurSpn); mSpnUpdatePending = false; } // Remove old network selection sharedPreferences since SP key names are now // changed to include subId. This will be done only once when upgrading from an // older build that did not include subId in the names. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences( context); String oldNetworkSelectionName = sp.getString(PhoneBase. NETWORK_SELECTION_NAME_KEY, ""); String oldNetworkSelection = sp.getString(PhoneBase.NETWORK_SELECTION_KEY, ""); if (!TextUtils.isEmpty(oldNetworkSelectionName) || !TextUtils.isEmpty(oldNetworkSelection)) { SharedPreferences.Editor editor = sp.edit(); editor.putString(PhoneBase.NETWORK_SELECTION_NAME_KEY + subId, oldNetworkSelectionName); editor.putString(PhoneBase.NETWORK_SELECTION_KEY + subId, oldNetworkSelection); editor.remove(PhoneBase.NETWORK_SELECTION_NAME_KEY); editor.remove(PhoneBase.NETWORK_SELECTION_KEY); editor.commit(); } } } } Loading
src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +0 −7 Original line number Diff line number Diff line Loading @@ -315,13 +315,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker { break; case EVENT_SIM_READY: boolean skipRestoringSelection = mPhone.getContext().getResources().getBoolean( com.android.internal.R.bool.skip_restoring_network_selection); if (!skipRestoringSelection) { // restore the previous network selection. mPhone.restoreSavedNetworkSelection(null); } pollState(); // Signal strength polling stops when radio is off queueNextSignalStrengthPoll(); Loading