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

Commit 6077d33a authored by Anshul Jain's avatar Anshul Jain Committed by Ethan Chen
Browse files

QualcommSharedRIL: Disable radio power request on ril socket connect

Google introduced the code to send the radio power off as soon as
the ril socket is connected. Telephony sends Radio Power On
before the response for radio power off is received from QMI.
QMI cannot handle a RADIO_POWER request when there is a
pending request already.
Block this radio power off request to avoid this scenario.
Long term solution would be to check for any pending
radio power response before sending the radio power
request.

Change-Id: I9b77cd9f400e543f8768f501586e89863b6837b5
parent 304af0cf
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -574,7 +574,8 @@ public class QualcommSharedRIL extends RIL implements CommandsInterface {
        }

        switch(response) {
            case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: ret =  responseVoid(p);
            case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: ret =  responseVoid(p); break;
            case RIL_UNSOL_RIL_CONNECTED: ret = responseInts(p); break;
            case 1035: ret = responseVoid(p); break; // RIL_UNSOL_VOICE_RADIO_TECH_CHANGED
            case 1036: ret = responseVoid(p); break; // RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED
            case 1037: ret = responseVoid(p); break; // RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE
@@ -594,6 +595,11 @@ public class QualcommSharedRIL extends RIL implements CommandsInterface {
                int state = p.readInt();
                setRadioStateFromRILInt(state);
                break;
            case RIL_UNSOL_RIL_CONNECTED:
                if (RILJ_LOGD) unsljLogRet(response, ret);

                notifyRegistrantsRilConnectionChanged(((int[])ret)[0]);
                break;
            case 1035:
            case 1036:
                break;
@@ -610,6 +616,19 @@ public class QualcommSharedRIL extends RIL implements CommandsInterface {
        }
    }

    /**
     * Notify all registrants that the ril has connected or disconnected.
     *
     * @param rilVer is the version of the ril or -1 if disconnected.
     */
    private void notifyRegistrantsRilConnectionChanged(int rilVer) {
        mRilVersion = rilVer;
        if (mRilConnectedRegistrants != null) {
            mRilConnectedRegistrants.notifyRegistrants(
                                new AsyncResult (null, new Integer(rilVer), null));
        }
    }

    private void setRadioStateFromRILInt (int stateCode) {
        CommandsInterface.RadioState radioState;
        HandlerThread handlerThread;