diff options
author | Robert Greenwalt <robdroid@android.com> | 2010-02-23 18:58:05 -0800 |
---|---|---|
committer | Robert Greenwalt <robdroid@android.com> | 2010-02-24 18:14:07 -0800 |
commit | c03fa5014912684367174ff3cce664deb29f5e0e (patch) | |
tree | 1f18a0a27c2f2fea7a1f73c84e88dcb98fe77f02 /telephony | |
parent | 240becc68d2ffa967d79af9c0ef50e6113420e47 (diff) | |
download | frameworks_base-c03fa5014912684367174ff3cce664deb29f5e0e.zip frameworks_base-c03fa5014912684367174ff3cce664deb29f5e0e.tar.gz frameworks_base-c03fa5014912684367174ff3cce664deb29f5e0e.tar.bz2 |
Add mobile data on/off switch.
bug:2251458
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java | 12 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index fbb3c4c..d5f18e0 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -23,6 +23,8 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; +import android.net.ConnectivityManager; +import android.net.IConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiManager; import android.os.AsyncResult; @@ -188,8 +190,16 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { // and 2) whether the RIL will setup the baseband to auto-PS attach. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(phone.getContext()); + boolean dataEnabledSetting = true; + try { + dataEnabledSetting = IConnectivityManager.Stub.asInterface(ServiceManager. + getService(Context.CONNECTIVITY_SERVICE)).getMobileDataEnabled(); + } catch (Exception e) { + // nothing to do - use the old behavior and leave data on + } dataEnabled[APN_DEFAULT_ID] = - !sp.getBoolean(CDMAPhone.DATA_DISABLED_ON_BOOT_KEY, false); + !sp.getBoolean(CDMAPhone.DATA_DISABLED_ON_BOOT_KEY, false) && + dataEnabledSetting; if (dataEnabled[APN_DEFAULT_ID]) { enabledCount++; } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 1fd6be8..30beaaa 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -27,6 +27,8 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.database.ContentObserver; import android.database.Cursor; +import android.net.ConnectivityManager; +import android.net.IConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.net.wifi.WifiManager; @@ -243,7 +245,15 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // This preference tells us 1) initial condition for "dataEnabled", // and 2) whether the RIL will setup the baseband to auto-PS attach. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(phone.getContext()); - dataEnabled[APN_DEFAULT_ID] = !sp.getBoolean(GSMPhone.DATA_DISABLED_ON_BOOT_KEY, false); + boolean dataEnabledSetting = true; + try { + dataEnabledSetting = IConnectivityManager.Stub.asInterface(ServiceManager. + getService(Context.CONNECTIVITY_SERVICE)).getMobileDataEnabled(); + } catch (Exception e) { + // nothing to do - use the old behavior and leave data on + } + dataEnabled[APN_DEFAULT_ID] = !sp.getBoolean(GSMPhone.DATA_DISABLED_ON_BOOT_KEY, false) && + dataEnabledSetting; if (dataEnabled[APN_DEFAULT_ID]) { enabledCount++; } |