diff options
| author | Robert Greenwalt <rgreenwalt@google.com> | 2014-05-21 20:04:36 -0700 |
|---|---|---|
| committer | Robert Greenwalt <rgreenwalt@google.com> | 2014-05-21 21:34:05 -0700 |
| commit | 47eecf03307acfb1bc7d4ad51311beb4eeb99366 (patch) | |
| tree | c99290c335a9564564cc2955c527f59a33cfac8d /core/java/android/net/ConnectivityManager.java | |
| parent | 0ddf4db856442b1af05f2c58d070a379d7b51242 (diff) | |
| download | frameworks_base-47eecf03307acfb1bc7d4ad51311beb4eeb99366.zip frameworks_base-47eecf03307acfb1bc7d4ad51311beb4eeb99366.tar.gz frameworks_base-47eecf03307acfb1bc7d4ad51311beb4eeb99366.tar.bz2 | |
Move dis/enable of mobile data to Telephony
ConnectivityService doesn't do this anymore.
bug:15077247
Change-Id: I3208c91b2c0369b594987f39ca29da7478435513
Diffstat (limited to 'core/java/android/net/ConnectivityManager.java')
| -rw-r--r-- | core/java/android/net/ConnectivityManager.java | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 80a9598..2f2aba3 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -35,15 +35,17 @@ import android.os.Messenger; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; +import android.telephony.TelephonyManager; import android.util.ArrayMap; import android.util.Log; +import com.android.internal.telephony.ITelephony; +import com.android.internal.util.Protocol; + import java.net.InetAddress; import java.util.concurrent.atomic.AtomicInteger; import java.util.HashMap; -import com.android.internal.util.Protocol; - /** * Class that answers queries about the state of network connectivity. It also * notifies applications when network connectivity changes. Get an instance @@ -940,34 +942,18 @@ public class ConnectivityManager { } /** - * Gets the value of the setting for enabling Mobile data. - * - * @return Whether mobile data is enabled. - * - * <p>This method requires the call to hold the permission - * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * @hide + * @deprecated Talk to TelephonyManager directly */ public boolean getMobileDataEnabled() { - try { - return mService.getMobileDataEnabled(); - } catch (RemoteException e) { - return true; - } - } - - /** - * Sets the persisted value for enabling/disabling Mobile data. - * - * @param enabled Whether the user wants the mobile data connection used - * or not. - * @hide - */ - public void setMobileDataEnabled(boolean enabled) { - try { - mService.setMobileDataEnabled(enabled); - } catch (RemoteException e) { + IBinder b = ServiceManager.getService(Context.TELEPHONY_SERVICE); + if (b != null) { + try { + ITelephony it = ITelephony.Stub.asInterface(b); + return it.getDataEnabled(); + } catch (RemoteException e) { } } + return false; } /** |
