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

Commit 4badb988 authored by Hunsuk Choi's avatar Hunsuk Choi
Browse files

Change the initial value of mLastBarringInfo

If the device has never camped on any network after booting,
the selector doesn't receive the BarringInfo.
So the domain selection stucks. With non-null initial value
even in this edge case, the selector continues to work.
Reset the last BarringInfo if the radio state is off or unavailable.

Bug: 264601502
Test: manual
Change-Id: Id6d6bf4ddad73645b071cb856d30f48339f6cac8
parent 58345722
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.Message;
import android.os.Registrant;
import android.os.RegistrantList;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.BarringInfo;
import android.telephony.TelephonyManager;
import android.telephony.emergency.EmergencyNumber;

@@ -173,6 +174,8 @@ public abstract class BaseCommands implements CommandsInterface {
    // Cache last emergency number list indication from radio
    private final List<EmergencyNumber> mLastEmergencyNumberListIndication = new ArrayList<>();

    // The last barring information received
    protected BarringInfo mLastBarringInfo = new BarringInfo();
    // Preferred network type received from PhoneFactory.
    // This is used when establishing a connection to the
    // vendor ril so it starts up in the correct mode.
@@ -913,6 +916,7 @@ public abstract class BaseCommands implements CommandsInterface {
                    || mState == TelephonyManager.RADIO_POWER_UNAVAILABLE)
                    && (oldState == TelephonyManager.RADIO_POWER_ON)) {
                mOffOrNotAvailRegistrants.notifyRegistrants();
                mLastBarringInfo = new BarringInfo();
            }
        }
    }
@@ -931,6 +935,12 @@ public abstract class BaseCommands implements CommandsInterface {
        }
    }

    /** {@inheritDoc} */
    @Override
    public @NonNull BarringInfo getLastBarringInfo() {
        return mLastBarringInfo;
    }

    /**
     * {@inheritDoc}
     */
+0 −9
Original line number Diff line number Diff line
@@ -275,9 +275,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
    final RilHandler mRilHandler;
    private MockModem mMockModem;

    // The last barring information received
    private BarringInfo mLastBarringInfo = null;

    // Thread-safe HashMap to map from RIL_REQUEST_XXX constant to HalVersion.
    // This is for Radio HAL Fallback Compatibility feature. When a RIL request
    // is received, the HAL method from the mapping HalVersion here (if present),
@@ -7178,12 +7175,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
        mBarringInfoChangedRegistrants.notifyRegistrants(new AsyncResult(null, barringInfo, null));
    }

    /** {@inheritDoc} */
    @Override
    public @Nullable BarringInfo getLastBarringInfo() {
        return mLastBarringInfo;
    }

    /**
     * Get the HAL version with a specific service.
     *