Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ddec998 authored by Magnus Strandberg's avatar Magnus Strandberg Committed by Iouri Lebedev
Browse files

Fix for updating TCP buffer size when switching network type

When PDP connects in GSM network, the TCP buffer window size is
set to max 8760. If the phone swicthes to UMTS, the TCP buffer
size is not updated to UMTS, i.e. GPRS buffer size is still
used with limited data transfer spead as a result.
This fix makes sure the TCP buffer size is updated when
switching network type.

Based off of (varible name change): https://android-review.googlesource.com/#/c/41612/

Change-Id: Idf19bca0b2eca218899aba68002d652b65070916
parent 95e26448
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -189,14 +189,24 @@ public class MobileDataStateTracker implements NetworkStateTracker {
                if (!TextUtils.equals(apnType, mApnType)) {
                    return;
                }
                mNetworkInfo.setSubtype(TelephonyManager.getDefault().getNetworkType(),
                        TelephonyManager.getDefault().getNetworkTypeName());


                int oldSubtype = mNetworkInfo.getSubtype();
                int newSubType = TelephonyManager.getDefault().getNetworkType();
                String subTypeName = TelephonyManager.getDefault().getNetworkTypeName();
                mNetworkInfo.setSubtype(newSubType, subTypeName);
                if (newSubType != oldSubtype && mNetworkInfo.isConnected()) {
                    Message msg = mTarget.obtainMessage(EVENT_NETWORK_SUBTYPE_CHANGED,
                                                        oldSubtype, 0, mNetworkInfo);
                    msg.sendToTarget();
                }

                Phone.DataState state = Enum.valueOf(Phone.DataState.class,
                        intent.getStringExtra(Phone.STATE_KEY));
                String reason = intent.getStringExtra(Phone.STATE_CHANGE_REASON_KEY);
                String apnName = intent.getStringExtra(Phone.DATA_APN_KEY);
                mNetworkInfo.setRoaming(intent.getBooleanExtra(Phone.DATA_NETWORK_ROAMING_KEY,
                        false));
                mNetworkInfo.setRoaming(intent.getBooleanExtra(
                        Phone.DATA_NETWORK_ROAMING_KEY, false));
                if (VDBG) {
                    log(mApnType + " setting isAvailable to " +
                            intent.getBooleanExtra(Phone.NETWORK_UNAVAILABLE_KEY,false));
+6 −0
Original line number Diff line number Diff line
@@ -68,6 +68,12 @@ public interface NetworkStateTracker {
     */
    public static final int EVENT_RESTORE_DEFAULT_NETWORK = 6;

    /**
     * msg.what = EVENT_NETWORK_SUBTYPE_CHANGED
     * msg.obj = NetworkInfo object
     */
    public static final int EVENT_NETWORK_SUBTYPE_CHANGED = 7;

    /**
     * -------------------------------------------------------------
     * Control Interface
+5 −0
Original line number Diff line number Diff line
@@ -2485,6 +2485,11 @@ private NetworkStateTracker makeWimaxStateTracker() {
                    //       @see bug/4455071
                    handleConnectivityChange(info.getType(), false);
                    break;
                case NetworkStateTracker.EVENT_NETWORK_SUBTYPE_CHANGED:
                    info = (NetworkInfo) msg.obj;
                    type = info.getType();
                    updateNetworkSettings(mNetTrackers[type]);
                    break;
                case EVENT_CLEAR_NET_TRANSITION_WAKELOCK:
                    String causedBy = null;
                    synchronized (ConnectivityService.this) {