diff options
author | Mengjun Leng <mengju@codeaurora.org> | 2016-05-13 12:05:03 +0200 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2017-11-16 19:34:18 +0100 |
commit | 33acc52d6740cbd21e656f6d7f6ba5f8c47b903a (patch) | |
tree | 00473586b5346c6e807db1d4fa9178000c3b15f4 /src/java | |
parent | 2475dfefb0d024a73604b751c054dd095866f18d (diff) | |
download | android_frameworks_opt_telephony-33acc52d6740cbd21e656f6d7f6ba5f8c47b903a.tar.gz android_frameworks_opt_telephony-33acc52d6740cbd21e656f6d7f6ba5f8c47b903a.tar.bz2 android_frameworks_opt_telephony-33acc52d6740cbd21e656f6d7f6ba5f8c47b903a.zip |
Use a config to enable MMS when mobile data is off
Some operators require that an MMS be allowed even when data
is turned off. Introduce a config to determine if MMS should
be allowed. By default this config is set to false.
Change-Id: Ic90dbac6084e62338cb46d1caf881a0ecc4b674b
Cleanup connections for APNs that are not connected
- After disabling a network, ConnectivityService tears down
the data connection
- However, for APNs that are in Connecting, Failed or Retry
state, ConnectivityService will not do that because the NetworkAgent
is created only when a DataConnection goes into Active State.
Take care of this case by explicitly tearing down the data connection
Change-Id: I87f286cb8b5fe5c6a33e8c5cf53da7bca8d7aa2b
DCT: Tear down MMS+default connections raised by config_enable_mms_with_mobile_data_off
If the tracker lets an MMS connection go through even if data is off, make sure
it's torn down once the disabled state gets applied. More often than not, APNs
configured as MMS+data would remain alive, and the tracker's state machine would
get stuck out of sync
Change-Id: Ia13e9ff5beea44ecfda40a4910990dab53af25dd
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/com/android/internal/telephony/dataconnection/DcTracker.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java index 46572f846..92886c01f 100644 --- a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java +++ b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java @@ -1616,6 +1616,15 @@ public class DcTracker extends Handler { } } + if (apnContext.getApnType().equals(PhoneConstants.APN_TYPE_MMS)) { + CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext() + .getSystemService(Context.CARRIER_CONFIG_SERVICE); + PersistableBundle pb = configManager.getConfigForSubId(mPhone.getSubId()); + if (pb != null) { + isDataAllowed = pb.getBoolean("config_enable_mms_with_mobile_data_off"); + } + } + if (apnContext.isConnectable() && (isEmergencyApn || (isDataAllowed && isDataAllowedForApn(apnContext) && !isEmergency()))) { @@ -2579,6 +2588,13 @@ public class DcTracker extends Handler { } } else if (met) { apnContext.setReason(Phone.REASON_DATA_DISABLED); + CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext() + .getSystemService(Context.CARRIER_CONFIG_SERVICE); + PersistableBundle pb = configManager.getConfigForSubId(mPhone.getSubId()); + boolean mmsWithMobileDataOff = false; + if (pb != null) { + mmsWithMobileDataOff = pb.getBoolean("config_enable_mms_with_mobile_data_off"); + } // If ConnectivityService has disabled this network, stop trying to bring // it up, but do not tear it down - ConnectivityService will do that // directly by talking with the DataConnection. @@ -2588,7 +2604,10 @@ public class DcTracker extends Handler { // request goes away. This applies to both CDMA and GSM because they both // can declare the DUN APN sharable by default traffic, thus still satisfying // those requests and not torn down organically. - if (apnContext.getApnType() == PhoneConstants.APN_TYPE_DUN && teardownForDun()) { + if ((apnContext.getApnType() == PhoneConstants.APN_TYPE_DUN && teardownForDun()) + || apnContext.getState() != DctConstants.State.CONNECTED + || (mmsWithMobileDataOff + && apnContext.getApnType().equals(PhoneConstants.APN_TYPE_MMS))) { cleanup = true; } else { cleanup = false; |