Loading src/java/com/android/internal/telephony/dataconnection/DataEnabledSettings.java +5 −5 Original line number Diff line number Diff line Loading @@ -28,15 +28,15 @@ import android.util.Pair; */ public class DataEnabledSettings { private static final int REASON_REGISTERED = 0; public static final int REASON_REGISTERED = 0; private static final int REASON_INTERNAL_DATA_ENABLED = 1; public static final int REASON_INTERNAL_DATA_ENABLED = 1; private static final int REASON_USER_DATA_ENABLED = 2; public static final int REASON_USER_DATA_ENABLED = 2; private static final int REASON_POLICY_DATA_ENABLED = 3; public static final int REASON_POLICY_DATA_ENABLED = 3; private static final int REASON_DATA_ENABLED_BY_CARRIER = 4; public static final int REASON_DATA_ENABLED_BY_CARRIER = 4; /** * responds to the setInternalDataEnabled call - used internally to turn off data. Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +28 −5 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyEventLog; import com.android.internal.telephony.TelephonyProperties; import com.android.internal.telephony.dataconnection.DataEnabledSettings; import com.android.internal.telephony.gsm.SuppServiceNotification; /** Loading Loading @@ -1362,6 +1363,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { case ImsReasonInfo.CODE_MAXIMUM_NUMBER_OF_CALLS_REACHED: return DisconnectCause.MAXIMUM_NUMBER_OF_CALLS_REACHED; case ImsReasonInfo.CODE_DATA_DISABLED: return DisconnectCause.DATA_DISABLED; case ImsReasonInfo.CODE_DATA_LIMIT_REACHED: return DisconnectCause.DATA_LIMIT_REACHED; default: } Loading Loading @@ -2613,20 +2620,36 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { /** * Handler of data enabled changed event * @param enabled True if data is enabled, otherwise disabled. * @param reason Reason for data enabled/disabled * @param reason Reason for data enabled/disabled (see {@code REASON_*} in * {@link DataEnabledSettings}. */ private void onDataEnabledChanged(boolean enabled, int reason) { log("onDataEnabledChanged: enabled=" + enabled + ", reason=" + reason); ImsManager.getInstance(mPhone.getContext(), mPhone.getPhoneId()).setDataEnabled(enabled); if (enabled == false) { // If data are disabled while there are ongoing VT calls, we need to downgrade // the VT calls (except on VT over Wifi) if (!enabled) { int reasonCode; if (reason == DataEnabledSettings.REASON_POLICY_DATA_ENABLED) { reasonCode = ImsReasonInfo.CODE_DATA_LIMIT_REACHED; } else if (reason == DataEnabledSettings.REASON_USER_DATA_ENABLED) { reasonCode = ImsReasonInfo.CODE_DATA_DISABLED; } else { // Unexpected code, default to data disabled. reasonCode = ImsReasonInfo.CODE_DATA_DISABLED; } // If data is disabled while there are ongoing VT calls which are not taking place over // wifi, then they should be disconnected to prevent the user from incurring further // data charges. for (ImsPhoneConnection conn : mConnections) { ImsCall imsCall = conn.getImsCall(); if (imsCall != null && imsCall.isVideoCall() && !imsCall.isWifiCall()) { modifyVideoCall(imsCall, VideoProfile.STATE_AUDIO_ONLY); try { imsCall.terminate(ImsReasonInfo.CODE_USER_TERMINATED, reasonCode); } catch (ImsException ie) { loge("Couldn't terminate call " + imsCall); } } } } Loading Loading
src/java/com/android/internal/telephony/dataconnection/DataEnabledSettings.java +5 −5 Original line number Diff line number Diff line Loading @@ -28,15 +28,15 @@ import android.util.Pair; */ public class DataEnabledSettings { private static final int REASON_REGISTERED = 0; public static final int REASON_REGISTERED = 0; private static final int REASON_INTERNAL_DATA_ENABLED = 1; public static final int REASON_INTERNAL_DATA_ENABLED = 1; private static final int REASON_USER_DATA_ENABLED = 2; public static final int REASON_USER_DATA_ENABLED = 2; private static final int REASON_POLICY_DATA_ENABLED = 3; public static final int REASON_POLICY_DATA_ENABLED = 3; private static final int REASON_DATA_ENABLED_BY_CARRIER = 4; public static final int REASON_DATA_ENABLED_BY_CARRIER = 4; /** * responds to the setInternalDataEnabled call - used internally to turn off data. Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +28 −5 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyEventLog; import com.android.internal.telephony.TelephonyProperties; import com.android.internal.telephony.dataconnection.DataEnabledSettings; import com.android.internal.telephony.gsm.SuppServiceNotification; /** Loading Loading @@ -1362,6 +1363,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { case ImsReasonInfo.CODE_MAXIMUM_NUMBER_OF_CALLS_REACHED: return DisconnectCause.MAXIMUM_NUMBER_OF_CALLS_REACHED; case ImsReasonInfo.CODE_DATA_DISABLED: return DisconnectCause.DATA_DISABLED; case ImsReasonInfo.CODE_DATA_LIMIT_REACHED: return DisconnectCause.DATA_LIMIT_REACHED; default: } Loading Loading @@ -2613,20 +2620,36 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { /** * Handler of data enabled changed event * @param enabled True if data is enabled, otherwise disabled. * @param reason Reason for data enabled/disabled * @param reason Reason for data enabled/disabled (see {@code REASON_*} in * {@link DataEnabledSettings}. */ private void onDataEnabledChanged(boolean enabled, int reason) { log("onDataEnabledChanged: enabled=" + enabled + ", reason=" + reason); ImsManager.getInstance(mPhone.getContext(), mPhone.getPhoneId()).setDataEnabled(enabled); if (enabled == false) { // If data are disabled while there are ongoing VT calls, we need to downgrade // the VT calls (except on VT over Wifi) if (!enabled) { int reasonCode; if (reason == DataEnabledSettings.REASON_POLICY_DATA_ENABLED) { reasonCode = ImsReasonInfo.CODE_DATA_LIMIT_REACHED; } else if (reason == DataEnabledSettings.REASON_USER_DATA_ENABLED) { reasonCode = ImsReasonInfo.CODE_DATA_DISABLED; } else { // Unexpected code, default to data disabled. reasonCode = ImsReasonInfo.CODE_DATA_DISABLED; } // If data is disabled while there are ongoing VT calls which are not taking place over // wifi, then they should be disconnected to prevent the user from incurring further // data charges. for (ImsPhoneConnection conn : mConnections) { ImsCall imsCall = conn.getImsCall(); if (imsCall != null && imsCall.isVideoCall() && !imsCall.isWifiCall()) { modifyVideoCall(imsCall, VideoProfile.STATE_AUDIO_ONLY); try { imsCall.terminate(ImsReasonInfo.CODE_USER_TERMINATED, reasonCode); } catch (ImsException ie) { loge("Couldn't terminate call " + imsCall); } } } } Loading