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

Commit c1e37f83 authored by Jack Yu's avatar Jack Yu Committed by Android (Google) Code Review
Browse files

Merge "Ignore phone switching while shutting down." into mnc-dr-dev

parents d32eea77 211ed45a
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  &&
@@ -1546,6 +1554,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;
    }
}