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

Commit 73596cb5 authored by Pengquan Meng's avatar Pengquan Meng
Browse files

Modify constructor of NetworkRegistrationState

This change the data specific constructor of NetworkRegistrationState to
make it adapt to the new NR indicators.

Bug: 111453000
Test: atest FrameworksTelephonyTests
Merged-In: I4e1f30ea8531a6a424c2c920c74257d4d673589d
Change-Id: I4e1f30ea8531a6a424c2c920c74257d4d673589d
parent 0a2a1e0e
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -33,17 +33,31 @@ public class DataSpecificRegistrationStates implements Parcelable{
     */
    public final boolean isNrAvailable;

    /**
     * Indicates that if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving
     * cell.
     *
     * True the primary serving cell is LTE cell and the plmn-InfoList-r15 is present in SIB2 and
     * at least one bit in this list is true, otherwise this value should be false.
     *
     * Reference: 3GPP TS 36.331 v15.2.2 6.3.1 System information blocks.
     */
    public final boolean isEnDcAvailable;

    DataSpecificRegistrationStates(
            int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable) {
            int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable,
            boolean isEnDcAvailable) {
        this.maxDataCalls = maxDataCalls;
        this.isDcNrRestricted = isDcNrRestricted;
        this.isNrAvailable = isNrAvailable;
        this.isEnDcAvailable = isEnDcAvailable;
    }

    private DataSpecificRegistrationStates(Parcel source) {
        maxDataCalls = source.readInt();
        isDcNrRestricted = source.readBoolean();
        isNrAvailable = source.readBoolean();
        isEnDcAvailable = source.readBoolean();
    }

    @Override
@@ -51,6 +65,7 @@ public class DataSpecificRegistrationStates implements Parcelable{
        dest.writeInt(maxDataCalls);
        dest.writeBoolean(isDcNrRestricted);
        dest.writeBoolean(isNrAvailable);
        dest.writeBoolean(isEnDcAvailable);
    }

    @Override
@@ -65,13 +80,14 @@ public class DataSpecificRegistrationStates implements Parcelable{
                .append(" maxDataCalls = " + maxDataCalls)
                .append(" isDcNrRestricted = " + isDcNrRestricted)
                .append(" isNrAvailable = " + isNrAvailable)
                .append(" isEnDcAvailable = " + isEnDcAvailable)
                .append(" }")
                .toString();
    }

    @Override
    public int hashCode() {
        return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable);
        return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable, isEnDcAvailable);
    }

    @Override
@@ -83,7 +99,8 @@ public class DataSpecificRegistrationStates implements Parcelable{
        DataSpecificRegistrationStates other = (DataSpecificRegistrationStates) o;
        return this.maxDataCalls == other.maxDataCalls
                && this.isDcNrRestricted == other.isDcNrRestricted
                && this.isNrAvailable == other.isNrAvailable;
                && this.isNrAvailable == other.isNrAvailable
                && this.isEnDcAvailable == other.isEnDcAvailable;
    }

    public static final Parcelable.Creator<DataSpecificRegistrationStates> CREATOR =
+31 −2
Original line number Diff line number Diff line
@@ -219,12 +219,13 @@ public class NetworkRegistrationState implements Parcelable {
    public NetworkRegistrationState(int domain, int transportType, int regState,
            int accessNetworkTechnology, int rejectCause, boolean emergencyOnly,
            int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls,
            boolean isDcNrRestricted, boolean isNrAvailable) {
            boolean isDcNrRestricted, boolean isNrAvailable, boolean isEndcAvailable) {
        this(domain, transportType, regState, accessNetworkTechnology, rejectCause, emergencyOnly,
                availableServices, cellIdentity);

        mDataSpecificStates = new DataSpecificRegistrationStates(
                maxDataCalls, isDcNrRestricted, isNrAvailable);
                maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable);
        updateNrStatus(mDataSpecificStates);
    }

    protected NetworkRegistrationState(Parcel source) {
@@ -448,6 +449,34 @@ public class NetworkRegistrationState implements Parcelable {
        dest.writeInt(mNrStatus);
    }

    /**
     * Use the 5G NR Non-Standalone indicators from the network registration state to update the
     * NR status. There are 3 indicators in the network registration state:
     *
     * 1. if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving cell.
     * 2. if NR is supported by the selected PLMN.
     * 3. if the use of dual connectivity with NR is restricted.
     *
     * The network has 5G NR capability if E-UTRA-NR Dual Connectivity is supported by the primary
     * serving cell.
     *
     * The use of NR 5G is not restricted If the network has 5G NR capability and both the use of
     * DCNR is not restricted and NR is supported by the selected PLMN. Otherwise the use of 5G
     * NR is restricted.
     *
     * @param state data specific registration state contains the 5G NR indicators.
     */
    private void updateNrStatus(DataSpecificRegistrationStates state) {
        mNrStatus = NR_STATUS_NONE;
        if (state.isEnDcAvailable) {
            if (!state.isDcNrRestricted && state.isNrAvailable) {
                mNrStatus = NR_STATUS_NOT_RESTRICTED;
            } else {
                mNrStatus = NR_STATUS_RESTRICTED;
            }
        }
    }

    public static final Parcelable.Creator<NetworkRegistrationState> CREATOR =
            new Parcelable.Creator<NetworkRegistrationState>() {
        @Override