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

Commit 070ab3d8 authored by Pengquan Meng's avatar Pengquan Meng Committed by android-build-merger
Browse files

Merge "Modify constructor of NetworkRegistrationState"

am: 61c09d12

Change-Id: I0b68c4cec94e5bd357871c864e42fbc3f44c39d0
parents edaf4401 61c09d12
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