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

Commit 211ed45a authored by Jack Yu's avatar Jack Yu
Browse files

Ignore phone switching while shutting down.

Ignoring phone switching during shutdown prevents initializing
the new phone, which sends attach request to the modem.

Bug: 23508972
Change-Id: I2a7bfaaebfc9ed3bc4a265b4fa0a31384195251e
parent ab88310b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1985,6 +1985,11 @@ public interface Phone {
     */
    public void shutdownRadio();

    /**
     * Return true if the device is shutting down.
     */
    public boolean isShuttingDown();

    /**
     *  Set phone radio capability
     *
+5 −0
Original line number Diff line number Diff line
@@ -2396,6 +2396,11 @@ public abstract class PhoneBase extends Handler implements Phone {
        getServiceStateTracker().requestShutdown();
    }

    @Override
    public boolean isShuttingDown() {
        return getServiceStateTracker().isDeviceShuttingDown();
    }

    @Override
    public void setRadioCapability(RadioCapability rc, Message response) {
        mCi.setRadioCapability(rc, response);
+11 −0
Original line number Diff line number Diff line
@@ -230,6 +230,14 @@ public class PhoneProxy extends Handler implements Phone {
                    newVoiceRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
                }
            } else {

                // If the device is shutting down, then there is no need to switch to the new phone
                // which might send unnecessary attach request to the modem.
                if (isShuttingDown()) {
                    logd("Device is shutting down. No need to switch phone now.");
                    return;
                }

                boolean matchCdma = ServiceState.isCdma(newVoiceRadioTech);
                boolean matchGsm = ServiceState.isGsm(newVoiceRadioTech);
                if ((matchCdma  &&
@@ -1542,6 +1550,9 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.shutdownRadio();
    }

    @Override
    public boolean isShuttingDown() { return mActivePhone.isShuttingDown(); }

    @Override
    public void setRadioCapability(RadioCapability rc, Message response) {
        mActivePhone.setRadioCapability(rc, response);
+5 −0
Original line number Diff line number Diff line
@@ -1142,4 +1142,9 @@ public abstract class ServiceStateTracker extends Handler {
    protected final boolean isNonRoamingInCdmaNetwork(BaseBundle b, String network) {
        return isInNetwork(b, network, CarrierConfigManager.KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY);
    }

    /** Check if the device is shutting down. */
    public final boolean isDeviceShuttingDown() {
        return mDeviceShuttingDown;
    }
}