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

Commit e942dd55 authored by Mike Kasick's avatar Mike Kasick
Browse files

SamsungRIL: Fixes for CDMA data reconnection failures due to stale pppd

Occasionally the CDMA data connection fails to reconnect after various
radio events, which is fixed neither by toggling mobile data nor airplane
mode, but only by a reboot.  One known cause of this problem is that the
pppd_cdma service is occasionally left running after the radio event, which
causes all subsequent "setup data call" operations to fail.  These two
fixes address the stale pppd_cdma service issue:

- Move the pppd_cdma service shutdown (set ril.cdma.data_state=0) from the
  "deactivate data call" response to its request.  This avoids the issue
  where the response never comes (radio crash?), and thus, the service is
  never stopped.

- Force pppd_cdma service shutdown on a "setup data call" failure.  This
  allows subsequent setup attempts to succeed in the event that the
  "deactivate" request was never made (unexpected radio poweroff).
parent 81b18090
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class SamsungRIL extends RIL implements CommandsInterface {
            case RIL_REQUEST_GET_IMEI: ret =  responseString(p); break;
            case RIL_REQUEST_GET_IMEISV: ret =  responseString(p); break;
            case RIL_REQUEST_ANSWER: ret =  responseVoid(p); break;
            case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret =  responseDeactivateDataCall(p); break;
            case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret =  responseVoid(p); break;
            case RIL_REQUEST_QUERY_FACILITY_LOCK: ret =  responseInts(p); break;
            case RIL_REQUEST_SET_FACILITY_LOCK: ret =  responseInts(p); break;
            case RIL_REQUEST_CHANGE_BARRING_PASSWORD: ret =  responseVoid(p); break;
@@ -897,6 +897,14 @@ public class SamsungRIL extends RIL implements CommandsInterface {
                }
            }
        } else {
            if (mIsSamsungCdma) {
                // On rare occasion the pppd_cdma service is left active from a stale
                // session, causing the data call setup to fail.  Make sure that pppd_cdma
                // is stopped now, so that the next setup attempt may succeed.
                Log.d(LOG_TAG, "Set ril.cdma.data_state=0 to make sure pppd_cdma is stopped.");
                SystemProperties.set("ril.cdma.data_state", "0");
            }

            dataCall.status = FailCause.ERROR_UNSPECIFIED.getErrorCode(); // Who knows?
        }

@@ -938,15 +946,16 @@ public class SamsungRIL extends RIL implements CommandsInterface {
        return false;
    }

    protected Object
    responseDeactivateDataCall(Parcel p) {
    @Override
    public void
    deactivateDataCall(int cid, int reason, Message result) {
        if (mIsSamsungCdma) {
            // Disconnect: Set ril.cdma.data_state=0 to stop pppd_cdma service.
            Log.d(LOG_TAG, "Set ril.cdma.data_state=0.");
            SystemProperties.set("ril.cdma.data_state", "0");
        }

        return null;
        super.deactivateDataCall(cid, reason, result);
    }

    protected Object