diff options
author | Stephen Bird <sbird@cyngn.com> | 2015-07-15 14:44:20 -0700 |
---|---|---|
committer | Stephen Bird <sbird@cyngn.com> | 2015-07-15 14:45:12 -0700 |
commit | 7ab48650d3d6fa28e3b86910fe45506becd7cb64 (patch) | |
tree | f21cabab788068d63b4a4dee072a28e52e584ebb | |
parent | 78a118f517619bed10197e8ad325ec9ef50c1e00 (diff) | |
download | android_frameworks_base-caf/cm-12.1.tar.gz android_frameworks_base-caf/cm-12.1.tar.bz2 android_frameworks_base-caf/cm-12.1.zip |
Data Toggle: Bring inline with mainline cyanogen settingscaf/cm-12.1
Make the profile data toggle work again
Change-Id: I527e39feabfa9e69fe359ca87cb380a010407f2d
-rw-r--r-- | core/java/android/app/ConnectionSettings.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/java/android/app/ConnectionSettings.java b/core/java/android/app/ConnectionSettings.java index f8c19253485..10f10ae771c 100644 --- a/core/java/android/app/ConnectionSettings.java +++ b/core/java/android/app/ConnectionSettings.java @@ -27,6 +27,9 @@ import android.nfc.NfcAdapter; import android.os.Parcel; import android.os.Parcelable; import android.provider.Settings; +import android.telephony.SubscriptionManager; +import android.telephony.TelephonyManager; + import com.android.internal.telephony.RILConstants; import org.xmlpull.v1.XmlPullParser; @@ -121,7 +124,8 @@ public final class ConnectionSettings implements Parcelable { BluetoothAdapter bta = BluetoothAdapter.getDefaultAdapter(); LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); - ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + TelephonyManager tm = (TelephonyManager) + context.getSystemService(Context.TELEPHONY_SERVICE); NfcAdapter nfcAdapter = null; try { nfcAdapter = NfcAdapter.getNfcAdapter(context); @@ -134,9 +138,15 @@ public final class ConnectionSettings implements Parcelable { switch (getConnectionId()) { case PROFILE_CONNECTION_MOBILEDATA: - currentState = cm.getMobileDataEnabled(); + currentState = tm.getDataEnabled(); if (forcedState != currentState) { -// hharte cm.setMobileDataEnabled(forcedState); + int phoneCount = tm.getPhoneCount(); + for (int i = 0; i < phoneCount; i++) { + Settings.Global.putInt(context.getContentResolver(), + Settings.Global.MOBILE_DATA + i, (forcedState) ? 1 : 0); + int[] subId = SubscriptionManager.getSubId(i); + tm.setDataEnabled(subId[0], forcedState); + } } break; case PROFILE_CONNECTION_2G3G4G: |