Move dis/enable of mobile data to Telephony
ConnectivityService doesn't do this anymore. bug:15077247 Change-Id: I3208c91b2c0369b594987f39ca29da7478435513
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user