Move dis/enable of mobile data to Telephony

ConnectivityService doesn't do this anymore.

bug:15077247
Change-Id: I3208c91b2c0369b594987f39ca29da7478435513
This commit is contained in:
Robert Greenwalt
2014-05-21 20:04:36 -07:00
parent 0ddf4db856
commit 47eecf0330
5 changed files with 47 additions and 70 deletions

View File

@@ -2249,4 +2249,25 @@ public class TelephonyManager {
}
return false;
}
/** @hide */
@PrivateApi
public void setDataEnabled(boolean enable) {
try {
getITelephony().setDataEnabled(enable);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setDataEnabled", e);
}
}
/** @hide */
@PrivateApi
public boolean getDataEnabled() {
try {
return getITelephony().getDataEnabled();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#getDataEnabled", e);
}
return false;
}
}

View File

@@ -436,4 +436,18 @@ interface ITelephony {
* @return true on success; false on any failure.
*/
boolean setPreferredNetworkType(int networkType);
/**
* User enable/disable Mobile Data.
*
* @param enable true to turn on, else false
*/
void setDataEnabled(boolean enable);
/**
* Get the user enabled state of Mobile Data.
*
* @return true on enabled
*/
boolean getDataEnabled();
}