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

Commit 4bd352bf authored by Jordan Liu's avatar Jordan Liu Committed by android-build-merger
Browse files

Merge "Update reference to config_restart_radio" am: 519b4406 am: 077b2119

am: 624a9a3b

Change-Id: Ie9b05b1cf1e6ed3c4b0b0bebf931ea316440f30d
parents 22ab2a8a 624a9a3b
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())
                                    + " result.isPermanentFail=" +
                                    mDct.isPermanentFail(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);
+24 −5
Original line number Diff line number Diff line
@@ -15,7 +15,10 @@
 */
package com.android.internal.telephony.dataconnection;

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

/**
@@ -117,8 +120,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 {
@@ -136,9 +137,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 isPermanentFail() {
+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();
            }