Move dis/enable of mobile data to Telephony
ConnectivityService doesn't do this anymore.
bug:15077247
Change-Id: I3208c91b2c0369b594987f39ca29da7478435513
(cherry picked from commit 9a32efc0c506eab679fd653924705c0010771fbd)
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 3354687..e79ad3c 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -21,7 +21,6 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.AsyncResult;
import android.os.Binder;
@@ -867,9 +866,7 @@
public boolean enableDataConnectivity() {
enforceModifyPermission();
- ConnectivityManager cm =
- (ConnectivityManager)mApp.getSystemService(Context.CONNECTIVITY_SERVICE);
- cm.setMobileDataEnabled(true);
+ mPhone.setDataEnabled(true);
return true;
}
@@ -885,9 +882,7 @@
public boolean disableDataConnectivity() {
enforceModifyPermission();
- ConnectivityManager cm =
- (ConnectivityManager)mApp.getSystemService(Context.CONNECTIVITY_SERVICE);
- cm.setMobileDataEnabled(false);
+ mPhone.setDataEnabled(false);
return true;
}
@@ -1394,4 +1389,27 @@
if (DBG) log("setPreferredNetworkType: " + (success ? "ok" : "fail"));
return success;
}
+
+ /**
+ * Set mobile data enabled
+ * Used by the user through settings etc to turn on/off mobile data
+ *
+ * @param enable {@code true} turn turn data on, else {@code false}
+ */
+ @Override
+ public void setDataEnabled(boolean enable) {
+ enforceModifyPermission();
+ mPhone.setDataEnabled(enable);
+ }
+
+ /**
+ * Get whether mobile data is enabled
+ *
+ * @return {@code true} if data is enabled else {@code false}
+ */
+ @Override
+ public boolean getDataEnabled() {
+ enforceModifyPermission();
+ return mPhone.getDataEnabled();
+ }
}