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

Commit 0ef065b1 authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Do not call getService() on wifi-only device.

Test: none
Bug: 35355251
Change-Id: If5b0cf2c04c21103849bf24b21ad71a79214e986
parent a929fd25
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -787,6 +787,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    boolean mIsMobileNetworkSupported;
    RadioResponse mRadioResponse;
    RadioIndication mRadioIndication;
    volatile IRadio mRadioProxy = null;
@@ -833,6 +834,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
    }

    private IRadio getRadioProxy(Message result) {
        if (!mIsMobileNetworkSupported) {
            if (RILJ_LOGV) riljLog("Not calling getService(): wifi-only");
            return null;
        }

        if (mRadioProxy != null) {
            return mRadioProxy;
        }
@@ -884,6 +890,10 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        mPhoneType = RILConstants.NO_PHONE;
        mPhoneId = instanceId;

        ConnectivityManager cm = (ConnectivityManager)context.getSystemService(
                Context.CONNECTIVITY_SERVICE);
        mIsMobileNetworkSupported = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);

        mRadioResponse = new RadioResponse(this);
        mRadioIndication = new RadioIndication(this);
        mRilHandler = new RilHandler();
@@ -909,9 +919,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        Looper looper = mSenderThread.getLooper();
        mSender = new RILSender(looper);

        ConnectivityManager cm = (ConnectivityManager)context.getSystemService(
                Context.CONNECTIVITY_SERVICE);
        if (cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == false) {
        if (!mIsMobileNetworkSupported) {
            riljLog("Not starting RILReceiver: wifi-only");
        } else {
            riljLog("Starting RILReceiver" + mPhoneId);