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

Commit 31f84bf1 authored by Jordan Liu's avatar Jordan Liu
Browse files

Update reference to config_restart_radio

For the switch to CarrierConfig, we update the method used to get the
value of what used to be called
config_restart_radio_on_pdp_fail_regular_deactivation to the new method
provided by CarrierConfig. Since we need to pass the context, we also
update the places this value is accessed so they pass their context.

Bug: 29873049
Change-Id: Id43344339b07628d62e640bf73f75af048a1259b
parent fbe51e4d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1475,7 +1475,8 @@ public class DataConnection extends StateMachine {
                                    + " delay=" + delay
                                    + " result=" + result
                                    + " result.isRestartRadioFail=" +
                                    result.mFailCause.isRestartRadioFail()
                                    result.mFailCause.isRestartRadioFail(mPhone.getContext(),
                                            mPhone.getSubId())
                                    + " isPermanentFailure=" +
                                    mDct.isPermanentFailure(result.mFailCause);
                            if (DBG) log(str);
+2 −1
Original line number Diff line number Diff line
@@ -268,7 +268,8 @@ public class DcController extends StateMachine {
                            mDct.isCleanupRequired.set(false);
                        } else {
                            DcFailCause failCause = DcFailCause.fromInt(newState.status);
                            if (failCause.isRestartRadioFail()) {
                            if (failCause.isRestartRadioFail(mPhone.getContext(),
                                        mPhone.getSubId())) {
                                if (DBG) {
                                    log("onDataStateChanged: X restart radio, failCause="
                                            + failCause);
+21 −5
Original line number Diff line number Diff line
@@ -122,8 +122,6 @@ public enum DcFailCause {
    LOST_CONNECTION(0x10004),
    RESET_BY_FRAMEWORK(0x10005);

    private final boolean mRestartRadioOnRegularDeactivation = Resources.getSystem().getBoolean(
            com.android.internal.R.bool.config_restart_radio_on_pdp_fail_regular_deactivation);
    private final int mErrorCode;
    private static final HashMap<Integer, DcFailCause> sErrorCodeToFailCauseMap;
    static {
@@ -147,9 +145,27 @@ public enum DcFailCause {
        return mErrorCode;
    }

    /** Radio has failed such that the radio should be restarted */
    public boolean isRestartRadioFail() {
        return (this == REGULAR_DEACTIVATION && mRestartRadioOnRegularDeactivation);
    /**
     * Returns whether or not the radio has failed and also needs to be restarted.
     * By default, we do not restart radio on REGULAR_DEACTIVATION.
     *
     * @param context device context
     * @param subId subscription id
     * @return true if the radio has failed and the carrier requres restart, otherwise false
     */
    public boolean isRestartRadioFail(Context context, int subId) {
        if (this == REGULAR_DEACTIVATION) {
            CarrierConfigManager configManager = (CarrierConfigManager)
                    context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
            if (configManager != null) {
                PersistableBundle b = configManager.getConfigForSubId(subId);
                if (b != null) {
                    return b.getBoolean(CarrierConfigManager.
                            KEY_RESTART_RADIO_ON_PDP_FAIL_REGULAR_DEACTIVATION_BOOL);
                }
            }
        }
        return false;
    }

    public boolean isPermanentFailure(Context context, int subId) {
+2 −1
Original line number Diff line number Diff line
@@ -3010,7 +3010,8 @@ public class DcTracker extends Handler {
            intent.putExtra(TelephonyIntents.EXTRA_APN_TYPE_KEY, apnContext.getApnType());
            mPhone.getCarrierSignalAgent().notifyCarrierSignalReceivers(intent);

            if (cause.isRestartRadioFail() || apnContext.restartOnError(cause.getErrorCode())) {
            if (cause.isRestartRadioFail(mPhone.getContext(), mPhone.getSubId()) ||
                    apnContext.restartOnError(cause.getErrorCode())) {
                if (DBG) log("Modem restarted.");
                sendRestartRadio();
            }