summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRobert Greenwalt <robdroid@android.com>2010-02-24 19:45:32 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-02-24 19:45:32 -0800
commit406b09bbd117446814a05aabc5971fd55c6afa5d (patch)
treebc3b08fe84878851d4d8743b682a0991596799ed /core
parentba289966c644bf54a747ba9b003f86ea7f12bfed (diff)
parentc03fa5014912684367174ff3cce664deb29f5e0e (diff)
downloadframeworks_base-406b09bbd117446814a05aabc5971fd55c6afa5d.zip
frameworks_base-406b09bbd117446814a05aabc5971fd55c6afa5d.tar.gz
frameworks_base-406b09bbd117446814a05aabc5971fd55c6afa5d.tar.bz2
Merge "Add mobile data on/off switch."
Diffstat (limited to 'core')
-rw-r--r--core/java/android/net/ConnectivityManager.java34
-rw-r--r--core/java/android/net/IConnectivityManager.aidl4
-rw-r--r--core/java/android/provider/Settings.java7
3 files changed, 42 insertions, 3 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index badb767..c76aca1 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -332,10 +332,10 @@ public class ConnectivityManager
/**
* Sets the value of the setting for background data usage.
- *
+ *
* @param allowBackgroundData Whether an application should use data while
* it is in the background.
- *
+ *
* @attr ref android.Manifest.permission#CHANGE_BACKGROUND_DATA_SETTING
* @see #getBackgroundDataSetting()
* @hide
@@ -346,7 +346,35 @@ public class ConnectivityManager
} catch (RemoteException e) {
}
}
-
+
+ /**
+ * Gets the value of the setting for enabling Mobile data.
+ *
+ * @return Whether mobile data is enabled.
+ * @hide
+ */
+ public boolean getMobileDataEnabled() {
+ try {
+ return mService.getMobileDataEnabled();
+ } catch (RemoteException e) {
+ return true;
+ }
+ }
+
+ /**
+ * Sets the persisted value for enabling/disabling Mobile data.
+ *
+ * @param allowMobileData Whether the mobile data connection should be
+ * used or not.
+ * @hide
+ */
+ public void setMobileDataEnabled(boolean enabled) {
+ try {
+ mService.setMobileDataEnabled(enabled);
+ } catch (RemoteException e) {
+ }
+ }
+
/**
* Don't allow use of default constructor.
*/
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 508e9c3..2514693 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -51,6 +51,10 @@ interface IConnectivityManager
void setBackgroundDataSetting(boolean allowBackgroundData);
+ boolean getMobileDataEnabled();
+
+ void setMobileDataEnabled(boolean enabled);
+
boolean tether(String iface);
boolean untether(String iface);
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index a020da4..b75a8cc 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2466,6 +2466,13 @@ public final class Settings {
public static final String BACKGROUND_DATA = "background_data";
/**
+ * Whether mobile data connections are allowed by the user. See
+ * ConnectivityManager for more info.
+ * @hide
+ */
+ public static final String MOBILE_DATA = "mobile_data";
+
+ /**
* The CDMA roaming mode 0 = Home Networks, CDMA default
* 1 = Roaming on Affiliated networks
* 2 = Roaming on any networks