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

Commit 2cf4d1f4 authored by Susheel nyamala's avatar Susheel nyamala Committed by Gerrit - the friendly Code Review server
Browse files

Telephony(MSIM): Fix tcp buffersize issue

On a multi-sim device, getNetworkType function call
in getTcpBufferSizesPropName function of
MobileDataStateTracker will return data radio technology
value on the subscription on which data call is
currently active.

Change-Id: I7c36a408cfa090a2801d03f61f86d6d1a148c7c2
CRs-Fixed: 661835
parent b6dcbae8
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker {

    private static final int UNKNOWN = LinkQualityInfo.UNKNOWN_INT;

    private static int mSubscription;

    /**
     * Create a new MobileDataStateTracker
     * @param netType the ConnectivityManager network type
@@ -254,9 +256,10 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker {
                    log("Broadcast received: " + intent.getAction() + " apnType=" + apnType);
                }

                int subscription = 0;
                if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) {
                    int dds = 0;
                    final int subscription = intent.getIntExtra(MSimConstants.SUBSCRIPTION_KEY,
                    subscription = intent.getIntExtra(MSimConstants.SUBSCRIPTION_KEY,
                            MSimConstants.DEFAULT_SUBSCRIPTION);
                    getPhoneService(false);

@@ -335,6 +338,7 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker {
                            setDetailedState(DetailedState.SUSPENDED, reason, apnName);
                            break;
                        case CONNECTED:
                            mSubscription = subscription;
                            updateLinkProperitesAndCapatilities(intent);
                            setDetailedState(DetailedState.CONNECTED, reason, apnName);
                            break;
@@ -432,9 +436,17 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker {
     */
    public String getTcpBufferSizesPropName() {
        String networkTypeStr = "unknown";
        int dataNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) {
            MSimTelephonyManager mSimTm = new MSimTelephonyManager(mContext);
            dataNetworkType = mSimTm.getNetworkType(mSubscription);
        } else {
            TelephonyManager tm = new TelephonyManager(mContext);
            dataNetworkType = tm.getNetworkType();
        }

        //TODO We have to edit the parameter for getNetworkType regarding CDMA
        switch(tm.getNetworkType()) {
        switch(dataNetworkType) {
        case TelephonyManager.NETWORK_TYPE_GPRS:
            networkTypeStr = "gprs";
            break;
@@ -483,7 +495,7 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker {
            networkTypeStr = "ehrpd";
            break;
        default:
            loge("unknown network type: " + tm.getNetworkType());
            loge("unknown network type: " + dataNetworkType);
        }
        return "net.tcp.buffersize." + networkTypeStr;
    }