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

Commit 0dc8618d authored by Wink Saville's avatar Wink Saville
Browse files

Do not start RILReceiver if wifi-only.

By not starting RILReceiver we don't waste any cycles
trying to communicate with a vendor ril which may
not exist. This allows a wifi-only device to operate
as expected and the system to gracefully handle the
missing radio as ril requests will report RADIO_NOT_AVAILABLE.

Change-Id: I6c6f60830486c5f0447b3b9eb44c8b1f2d70c517
parent 5107eea6
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -244,6 +244,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

    Object     mLastNITZTimeInfo;

    private static final String WIFI_ONLY_CARRIER = "wifi-only";

    //***** Events

    static final int EVENT_SEND                 = 1;
@@ -656,6 +658,13 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        Looper looper = mSenderThread.getLooper();
        mSender = new RILSender(looper);

        // TODO: Provide a common API for determining if a
        // device is wifi-only. bug: 3480713
        String carrier = SystemProperties.get("ro.carrier");
        if (WIFI_ONLY_CARRIER.equals(carrier)) {
            riljLog("Not starting RILReceiver: wifi-only");
        } else {
            riljLog("Starting RILReceiver");
            mReceiver = new RILReceiver();
            mReceiverThread = new Thread(mReceiver, "RILReceiver");
            mReceiverThread.start();
@@ -665,6 +674,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            filter.addAction(Intent.ACTION_SCREEN_OFF);
            context.registerReceiver(mIntentReceiver, filter);
        }
    }

    //***** CommandsInterface implementation