Save network mode on GSM devices.

We save the mode in OnClick and handleGetPreferredNetworkTypeResponse
so the preferred network mode tracks the UI as best as possible.

On GSM devices when "Use only 2G networks" was
checed in Settings > More > Mobile Networks the
value wasn't saved. Thus when rebooting the mode
would revert to the previous value.

Looking at the history, it has been this way a
long time, but it must have worked because the
radio preserved the value, returning when the
current PREFERRED_NETWORK_TYPE was requested.

With ICS Samsung upgraded the Crespo radio and the value
doesn't always appear to be preserved. In any case
its better for the framework to preserve the value
rather than relying on actions of the many radio
implementations.

Bug: 5764203
Change-Id: I9ed5db4e5c2db01cdd54bc1cc36395326b209fe3
diff --git a/src/com/android/phone/Use2GOnlyCheckBoxPreference.java b/src/com/android/phone/Use2GOnlyCheckBoxPreference.java
index 42e3068..1fa83a7 100644
--- a/src/com/android/phone/Use2GOnlyCheckBoxPreference.java
+++ b/src/com/android/phone/Use2GOnlyCheckBoxPreference.java
@@ -55,6 +55,8 @@
 
         int networkType = isChecked() ? Phone.NT_MODE_GSM_ONLY : Phone.NT_MODE_WCDMA_PREF;
         Log.i(LOG_TAG, "set preferred network type="+networkType);
+        android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, networkType);
         mPhone.setPreferredNetworkType(networkType, mHandler
                 .obtainMessage(MyHandler.MESSAGE_SET_PREFERRED_NETWORK_TYPE));
    }
@@ -84,6 +86,8 @@
                 int type = ((int[])ar.result)[0];
                 Log.i(LOG_TAG, "get preferred network type="+type);
                 setChecked(type == Phone.NT_MODE_GSM_ONLY);
+                android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, type);
             } else {
                 // Weird state, disable the setting
                 Log.i(LOG_TAG, "get preferred network type, exception="+ar.exception);