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

Commit 5de8d619 authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Force notify radio state change to registrants if IRadio service crashes

Or any time there is an issue suspected from lower layers. This is to
make sure UiccSlot/Card/Profile and the records are cleaned up so that
they can be re-read.

Test: basic sanity
Bug: 113141315
Change-Id: I1807c123701d0f9f58eac88b5797f4925ac85134
parent 15d535ee
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -792,15 +792,17 @@ public abstract class BaseCommands implements CommandsInterface {
     * RadioState has 3 values : RADIO_OFF, RADIO_UNAVAILABLE, RADIO_ON.
     *
     * @param newState new RadioState decoded from RIL_UNSOL_RADIO_STATE_CHANGED
     * @param forceNotifyRegistrants boolean indicating if registrants should be notified even if
     * there is no change in state
     */
    protected void setRadioState(RadioState newState) {
    protected void setRadioState(RadioState newState, boolean forceNotifyRegistrants) {
        RadioState oldState;

        synchronized (mStateMonitor) {
            oldState = mState;
            mState = newState;

            if (oldState == mState) {
            if (oldState == mState && !forceNotifyRegistrants) {
                // no state transition
                return;
            }
+2 −2
Original line number Diff line number Diff line
@@ -353,7 +353,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        // increment the cookie so that death notification can be ignored
        mRadioProxyCookie.incrementAndGet();

        setRadioState(RadioState.RADIO_UNAVAILABLE);
        setRadioState(RadioState.RADIO_UNAVAILABLE, true /* forceNotifyRegistrants */);

        RILRequest.resetSerial();
        // Clear request list on close
@@ -4188,7 +4188,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                }
                break;
            case RIL_REQUEST_SHUTDOWN:
                setRadioState(RadioState.RADIO_UNAVAILABLE);
                setRadioState(RadioState.RADIO_UNAVAILABLE, false /* forceNotifyRegistrants */);
                break;
        }

+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public class RadioIndication extends IRadioIndication.Stub {
                    newState);
        }

        mRil.setRadioState(newState);
        mRil.setRadioState(newState, false /* forceNotifyRegistrants */);
    }

    public void callStateChanged(int indicationType) {
+5 −5
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public class SimulatedCommands extends BaseCommands

        simulatedCallState = new SimulatedGsmCallState(looper);

        setRadioState(RadioState.RADIO_ON);
        setRadioState(RadioState.RADIO_ON, false /* forceNotifyRegistrants */);
        mSimLockedState = INITIAL_LOCK_STATE;
        mSimLockEnabled = (mSimLockedState != SimLockState.NONE);
        mPinCode = DEFAULT_SIM_PIN_CODE;
@@ -1241,9 +1241,9 @@ public class SimulatedCommands extends BaseCommands
        }

        if(on) {
            setRadioState(RadioState.RADIO_ON);
            setRadioState(RadioState.RADIO_ON, false /* forceNotifyRegistrants */);
        } else {
            setRadioState(RadioState.RADIO_OFF);
            setRadioState(RadioState.RADIO_OFF, false /* forceNotifyRegistrants */);
        }
        resultSuccess(result, null);
    }
@@ -1599,7 +1599,7 @@ public class SimulatedCommands extends BaseCommands
    @Override
    public void
    shutdown() {
        setRadioState(RadioState.RADIO_UNAVAILABLE);
        setRadioState(RadioState.RADIO_UNAVAILABLE, false /* forceNotifyRegistrants */);
        Looper looper = mHandlerThread.getLooper();
        if (looper != null) {
            looper.quit();
@@ -2024,7 +2024,7 @@ public class SimulatedCommands extends BaseCommands

    @Override
    public void requestShutdown(Message result) {
        setRadioState(RadioState.RADIO_UNAVAILABLE);
        setRadioState(RadioState.RADIO_UNAVAILABLE, false /* forceNotifyRegistrants */);
    }

    @Override