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

Commit 383fc550 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.

Merged-In: Id43344339b07628d62e640bf73f75af048a1259b

Bug: 29873049
Change-Id: Iba091f43e094b823b5f27db6b5f05b5a362c4658
parent 7c08118a
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1404,7 +1404,8 @@ public class DataConnection extends StateMachine {
                                    + " delay=" + delay
                                    + " delay=" + delay
                                    + " result=" + result
                                    + " result=" + result
                                    + " result.isRestartRadioFail=" +
                                    + " result.isRestartRadioFail=" +
                                    result.mFailCause.isRestartRadioFail()
                                    result.mFailCause.isRestartRadioFail(mPhone.getContext(),
                                            mPhone.getSubId())
                                    + " result.isPermanentFail=" +
                                    + " result.isPermanentFail=" +
                                    mDct.isPermanentFail(result.mFailCause);
                                    mDct.isPermanentFail(result.mFailCause);
                            if (DBG) log(str);
                            if (DBG) log(str);
+2 −1
Original line number Original line Diff line number Diff line
@@ -264,7 +264,8 @@ public class DcController extends StateMachine {
                            mDct.isCleanupRequired.set(false);
                            mDct.isCleanupRequired.set(false);
                        } else {
                        } else {
                            DcFailCause failCause = DcFailCause.fromInt(newState.status);
                            DcFailCause failCause = DcFailCause.fromInt(newState.status);
                            if (failCause.isRestartRadioFail()) {
                            if (failCause.isRestartRadioFail(mPhone.getContext(),
                                        mPhone.getSubId())) {
                                if (DBG) {
                                if (DBG) {
                                    log("onDataStateChanged: X restart radio, failCause="
                                    log("onDataStateChanged: X restart radio, failCause="
                                            + failCause);
                                            + failCause);
+24 −5
Original line number Original line Diff line number Diff line
@@ -15,7 +15,10 @@
 */
 */
package com.android.internal.telephony.dataconnection;
package com.android.internal.telephony.dataconnection;


import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import java.util.HashMap;
import java.util.HashMap;


/**
/**
@@ -117,8 +120,6 @@ public enum DcFailCause {
    LOST_CONNECTION(0x10004),
    LOST_CONNECTION(0x10004),
    RESET_BY_FRAMEWORK(0x10005);
    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 final int mErrorCode;
    private static final HashMap<Integer, DcFailCause> sErrorCodeToFailCauseMap;
    private static final HashMap<Integer, DcFailCause> sErrorCodeToFailCauseMap;
    static {
    static {
@@ -136,9 +137,27 @@ public enum DcFailCause {
        return mErrorCode;
        return mErrorCode;
    }
    }


    /** Radio has failed such that the radio should be restarted */
    /**
    public boolean isRestartRadioFail() {
     * Returns whether or not the radio has failed and also needs to be restarted.
        return (this == REGULAR_DEACTIVATION && mRestartRadioOnRegularDeactivation);
     * 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 isPermanentFail() {
    public boolean isPermanentFail() {
+2 −1
Original line number Original line Diff line number Diff line
@@ -3008,7 +3008,8 @@ public class DcTracker extends Handler {
            intent.putExtra(APN_TYPE_KEY, apnContext.getApnType());
            intent.putExtra(APN_TYPE_KEY, apnContext.getApnType());
            notifyCarrierAppWithIntent(intent);
            notifyCarrierAppWithIntent(intent);


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