summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorDavid van Tonder <david.vantonder@gmail.com>2013-06-26 16:57:41 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-06-26 16:57:41 -0700
commitaf124f73067246ac52bd85e67210838498e6554f (patch)
tree1d047917d43812826d8f48a66f125b61874a0941 /core/java
parent00539be0adf7d847384080081ab8a87a82317dfb (diff)
parent99332b1cd18d5ae6c6a3ca4cc373a7ffa53128de (diff)
downloadframeworks_base-af124f73067246ac52bd85e67210838498e6554f.zip
frameworks_base-af124f73067246ac52bd85e67210838498e6554f.tar.gz
frameworks_base-af124f73067246ac52bd85e67210838498e6554f.tar.bz2
Merge "Add 2G/3G option to profile connections (1/2)" into cm-10.1
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ConnectionSettings.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/java/android/app/ConnectionSettings.java b/core/java/android/app/ConnectionSettings.java
index cf6c110..09eb0b9 100644
--- a/core/java/android/app/ConnectionSettings.java
+++ b/core/java/android/app/ConnectionSettings.java
@@ -3,6 +3,7 @@ package android.app;
import android.bluetooth.BluetoothAdapter;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.Intent;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
@@ -11,6 +12,7 @@ import android.nfc.NfcAdapter;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.Settings;
+import com.android.internal.telephony.RILConstants;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -33,6 +35,15 @@ public final class ConnectionSettings implements Parcelable {
public static final int PROFILE_CONNECTION_SYNC = 5;
public static final int PROFILE_CONNECTION_BLUETOOTH = 7;
public static final int PROFILE_CONNECTION_NFC = 8;
+ public static final int PROFILE_CONNECTION_2G3G = 9;
+
+ // retrieved from Phone.apk
+ private static final String ACTION_MODIFY_NETWORK_MODE = "com.android.internal.telephony.MODIFY_NETWORK_MODE";
+ private static final String EXTRA_NETWORK_MODE = "networkMode";
+
+ private static final int CM_MODE_2G = 0;
+ private static final int CM_MODE_3G = 1;
+ private static final int CM_MODE_BOTH = 2;
/** @hide */
public static final Parcelable.Creator<ConnectionSettings> CREATOR = new Parcelable.Creator<ConnectionSettings>() {
@@ -111,6 +122,23 @@ public final class ConnectionSettings implements Parcelable {
cm.setMobileDataEnabled(forcedState);
}
break;
+ case PROFILE_CONNECTION_2G3G:
+ Intent intent = new Intent(ACTION_MODIFY_NETWORK_MODE);
+ switch(getValue()) {
+ case CM_MODE_2G:
+ intent.putExtra(EXTRA_NETWORK_MODE, RILConstants.NETWORK_MODE_GSM_ONLY);
+ break;
+ case CM_MODE_3G:
+ intent.putExtra(EXTRA_NETWORK_MODE, RILConstants.NETWORK_MODE_WCDMA_ONLY);
+ break;
+ case CM_MODE_BOTH:
+ intent.putExtra(EXTRA_NETWORK_MODE, RILConstants.NETWORK_MODE_WCDMA_PREF);
+ break;
+ default:
+ return;
+ }
+ context.sendBroadcast(intent);
+ break;
case PROFILE_CONNECTION_BLUETOOTH:
int btstate = bta.getState();
if (forcedState && (btstate == BluetoothAdapter.STATE_OFF