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

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

Fix data disconnect issue on G sub for C+G DSDS

On a DSDS Cdma+Gsm device, when data is registered on both Cdma and Gsm
subscriptions and DDS is on Gsm sub, if data deregister happens on Cdma
sub, data disconnect is getting propagated to connectivity service
irrespective of DDS, hence data is getting disconnected on Gsm sub.

Add code changes to block data disconnect getting propagated to
connectivity service when the subscription is not DDS.

Change-Id: I329d6a20ace65cad494e36dd9ec5a6470db2fbd7
CRs-Fixed: 544292
parent 4f04151e
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.util.Slog;
import com.android.internal.telephony.DctConstants;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.msim.ITelephonyMSim;
import com.android.internal.telephony.MSimConstants;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.util.AsyncChannel;
@@ -253,6 +254,37 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker {
                    log("Broadcast received: " + intent.getAction() + " apnType=" + apnType);
                }

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

                   /*
                    * If the phone process has crashed in the past, we'll get a
                    * RemoteException and need to re-reference the service.
                    */
                    for (int retry = 0; retry < 2; retry++) {
                        if (mMSimPhoneService == null) {
                            loge("Ignoring get dds request because "
                                    + "MSim Phone Service is not available");
                            break;
                        }

                        try {
                            dds = mMSimPhoneService.getPreferredDataSubscription();
                        } catch (RemoteException e) {
                            if (retry == 0) getPhoneService(true);
                        }
                    }
                    log(String.format("subscription=%s, dds=%s", subscription, dds));
                    if (subscription != dds) {
                        log("ignore data connection state as sub:" + subscription +
                                " is not current dds: " + dds);
                        return;
                    }
                }

                int oldSubtype = mNetworkInfo.getSubtype();
                int newSubType = TelephonyManager.getDefault().getNetworkType();
                String subTypeName = TelephonyManager.getDefault().getNetworkTypeName();
+19 −9
Original line number Diff line number Diff line
@@ -317,8 +317,10 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub {
                    }
                    if ((events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
                        try {
                            if (r.subscription == subscription) {
                                r.callback.onDataConnectionStateChanged(mDataConnectionState,
                                        mDataConnectionNetworkType);
                            }
                        } catch (RemoteException ex) {
                            remove(r.binder);
                        }
@@ -532,7 +534,8 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub {

    public void notifyDataConnection(int state, boolean isDataConnectivityPossible,
            String reason, String apn, String apnType, LinkProperties linkProperties,
            LinkCapabilities linkCapabilities, int networkType, boolean roaming) {
            LinkCapabilities linkCapabilities, int networkType, boolean roaming,
            int subscription) {
        if (!checkNotifyPermission("notifyDataConnection()" )) {
            return;
        }
@@ -578,8 +581,11 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub {
                        + ", " + mDataConnectionNetworkType + ")");
                }
                for (Record r : mRecords) {
                    if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
                    if (((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) &&
                            (r.subscription == subscription)) {
                        try {
                            Slog.d(TAG,"Notify data connection state changed on sub: " +
                                    subscription);
                            r.callback.onDataConnectionStateChanged(mDataConnectionState,
                                    mDataConnectionNetworkType);
                        } catch (RemoteException ex) {
@@ -591,10 +597,11 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub {
            }
        }
        broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn,
                apnType, linkProperties, linkCapabilities, roaming);
                apnType, linkProperties, linkCapabilities, roaming, subscription);
    }

    public void notifyDataConnectionFailed(String reason, String apnType) {
    public void notifyDataConnectionFailed(String reason, String apnType,
            int subscription) {
        if (!checkNotifyPermission("notifyDataConnectionFailed()")) {
            return;
        }
@@ -612,7 +619,7 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub {
            }
        }
        */
        broadcastDataConnectionFailed(reason, apnType);
        broadcastDataConnectionFailed(reason, apnType, subscription);
    }

    public void notifyCellLocation(Bundle cellLocation, int subscription) {
@@ -755,7 +762,7 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub {
    private void broadcastDataConnectionStateChanged(int state,
            boolean isDataConnectivityPossible,
            String reason, String apn, String apnType, LinkProperties linkProperties,
            LinkCapabilities linkCapabilities, boolean roaming) {
            LinkCapabilities linkCapabilities, boolean roaming, int subscription) {
        // Note: not reporting to the battery stats service here, because the
        // status bar takes care of that after taking into account all of the
        // required info.
@@ -782,15 +789,18 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub {

        intent.putExtra(PhoneConstants.DATA_APN_KEY, apn);
        intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType);
        intent.putExtra(MSimConstants.SUBSCRIPTION_KEY, subscription);
        mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
    }

    private void broadcastDataConnectionFailed(String reason, String apnType) {
    private void broadcastDataConnectionFailed(String reason, String apnType,
            int subscription) {
        Intent intent = new Intent(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED);
        intent.putExtra(PhoneConstants.FAILURE_REASON_KEY, reason);
        intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType);
        intent.putExtra(MSimConstants.SUBSCRIPTION_KEY,
                MSimTelephonyManager.getDefault().getPreferredDataSubscription());
        intent.putExtra(MSimConstants.SUBSCRIPTION_KEY, subscription);
        mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
    }

+3 −2
Original line number Diff line number Diff line
@@ -39,8 +39,9 @@ interface ITelephonyRegistryMSim {
    void notifyDataActivity(int state);
    void notifyDataConnection(int state, boolean isDataConnectivityPossible,
            String reason, String apn, String apnType, in LinkProperties linkProperties,
            in LinkCapabilities linkCapabilities, int networkType, boolean roaming);
    void notifyDataConnectionFailed(String reason, String apnType);
            in LinkCapabilities linkCapabilities, int networkType, boolean roaming,
            int subscription);
    void notifyDataConnectionFailed(String reason, String apnType, int subscription);
    void notifyCellLocation(in Bundle cellLocation, in int subscription);
    void notifyOtaspChanged(in int otaspMode);
    void notifyCellInfo(in List<CellInfo> cellInfo, in int subscription);