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

Commit 6450d47d authored by Yashdev Singh's avatar Yashdev Singh Committed by Gerrit - the friendly Code Review server
Browse files

Telephony: Fix DcSwitchStateMachine hung issue.

Issues seems to occur as follow..
1. Config CT + CMCC.
2. DDS is present on CMCC.
3. remove/deactivate CMCC SIm.
4. reboot the device.
5. Since the DDS SIM was removed/deactivated above, DDS was
   attempted on CT SIM, which was rejected by modem. So now
   modem is having DDS set on CMCC sub but Android remembers
   DDS on CT sub.
6. At the bootup android tries to set the DDS on CT sub.
7. Modem reports data in service on CMCC sub.
8. DcSwitchSTateMachine of CMCC sub ignores the data in
   service event on non-dds-cmcc sub.
7. Primary card feature kicks in and tries to move the DDS on
   CMCC.
8. DcSwitchStatemachine request ATTACH and wait for data-in-service
   to be reported.
9. Modem is already in service on CMCC and hence
   DcSwitchStateMachine does not get further event to progress the
   state-machine to ATTACHED state and hence the issue.

Fix:
- Upon ALLOW_DATA(true) success event in ATTACHING state
  move to ATTACHED state if data is already REGISTERED.

Change-Id: I29e6d80f315a8d9593e0bd59553a561492057f2d
parent 1176973c
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.internal.telephony.SubscriptionController;
import android.os.AsyncResult;
import android.os.AsyncResult;
import android.os.Message;
import android.os.Message;
import android.telephony.Rlog;
import android.telephony.Rlog;
import android.telephony.ServiceState;


public class DcSwitchStateMachine extends StateMachine {
public class DcSwitchStateMachine extends StateMachine {
    private static final boolean DBG = true;
    private static final boolean DBG = true;
@@ -298,6 +299,16 @@ public class DcSwitchStateMachine extends StateMachine {
                        } else {
                        } else {
                            logd("EVENT_DATA_ALLOWED success");
                            logd("EVENT_DATA_ALLOWED success");
                            mResponseMsg = null;
                            mResponseMsg = null;

                            /* If the data service state is IN_SERVICE then move to
                             * ATTACHED state.
                             */
                            int dataState = mPhone.getServiceState().getDataRegState();
                            if (dataState == ServiceState.STATE_IN_SERVICE) {
                                logd("AttachingState: Already attached, move to ATTACHED state");
                                transitionTo(mAttachedState);
                            }

                        }
                        }
                    }
                    }
                    retVal = HANDLED;
                    retVal = HANDLED;
+0 −34
Original line number Original line Diff line number Diff line
@@ -388,44 +388,10 @@ public class DctController extends Handler {
                RequestInfo requestInfo = mRequestInfos.get(iterator.next());
                RequestInfo requestInfo = mRequestInfos.get(iterator.next());
                if (getRequestPhoneId(requestInfo.request) == phoneId && !requestInfo.executed) {
                if (getRequestPhoneId(requestInfo.request) == phoneId && !requestInfo.executed) {
                    mDcSwitchAsyncChannel[phoneId].connect(requestInfo);
                    mDcSwitchAsyncChannel[phoneId].connect(requestInfo);
                    Phone phone = mPhones[phoneId].getActivePhone();
                    if ((phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)
                            && (activePhoneId == -1)) {
                        /* Traditionally modem reports data registered on CDMA sub even when it is
                         * non-dds because CDMA network does not have PS ATTACH/DETACH concept.
                         *
                         * So when CDMA sub becomes DDS from non-dds the state-machine is expacting
                         * onDataConnectionAttach() call from serviceStateTracker. It would never
                         * happen since cdma SST did not notice change in registration during DDS
                         * switch.
                         *
                         * Hence we need to fake the ATTACH to move/progress DcSwitchStateMachine.
                         */
                        logd("Active phone is CDMA, fake ATTACH");
                        mDcSwitchAsyncChannel[phoneId].notifyDataAttached();
                    }

                }
                }
            }
            }
        } else {
        } else {
            Phone phone = mPhones[activePhoneId].getActivePhone();
            mDcSwitchAsyncChannel[activePhoneId].disconnectAll();
            mDcSwitchAsyncChannel[activePhoneId].disconnectAll();
            if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
                /* Traditionally modem reports data registered on CDMA sub even when it is
                 * non-dds because CDMA network does not have PS ATTACH/DETACH concept.
                 *
                 * So when CDMA sub becomes non-dds from dds the state-machine is expacting
                 * onDataConnectionDetached() call from serviceStateTracker. It would never
                 * happen since cdma SST did not notice change in registration during DDS
                 * switch.
                 *
                 * Hence we need to fake the DETACH to move/progress DcSwitchStateMachine.
                 */

                logd("Active phone is CDMA, fake DETACH");
                mDcSwitchAsyncChannel[activePhoneId].notifyDataDetached();

            }
        }
        }
    }
    }