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

Commit 2d2f4a21 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati Committed by Android (Google) Code Review
Browse files

Merge "Add isNonTerrestrialNetwork apis in NetworkRegistrationInfo for...

Merge "Add isNonTerrestrialNetwork apis in NetworkRegistrationInfo for satellite connectivity" into udc-qpr-dev
parents ff651d3a 63563a80
Loading
Loading
Loading
Loading
+54 −6
Original line number Diff line number Diff line
@@ -257,6 +257,9 @@ public final class NetworkRegistrationInfo implements Parcelable {
    // Updated based on the accessNetworkTechnology
    private boolean mIsUsingCarrierAggregation;

    // Set to {@code true} when network is a non-terrestrial network.
    private boolean mIsNonTerrestrialNetwork;

    /**
     * @param domain Network domain. Must be a {@link Domain}. For transport type
     * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this must set to {@link #DOMAIN_PS}.
@@ -280,6 +283,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
     * @param rplmn the registered plmn or the last plmn for attempted registration if reg failed.
     * @param voiceSpecificInfo Voice specific registration information.
     * @param dataSpecificInfo Data specific registration information.
     * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network.
     */
    private NetworkRegistrationInfo(@Domain int domain, @TransportType int transportType,
            @RegistrationState int registrationState,
@@ -287,7 +291,8 @@ public final class NetworkRegistrationInfo implements Parcelable {
            boolean emergencyOnly, @Nullable @ServiceType List<Integer> availableServices,
            @Nullable CellIdentity cellIdentity, @Nullable String rplmn,
            @Nullable VoiceSpecificRegistrationInfo voiceSpecificInfo,
            @Nullable DataSpecificRegistrationInfo dataSpecificInfo) {
            @Nullable DataSpecificRegistrationInfo dataSpecificInfo,
            boolean isNonTerrestrialNetwork) {
        mDomain = domain;
        mTransportType = transportType;
        mRegistrationState = registrationState;
@@ -304,6 +309,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        mRplmn = rplmn;
        mVoiceSpecificInfo = voiceSpecificInfo;
        mDataSpecificInfo = dataSpecificInfo;
        mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;

        updateNrState();
    }
@@ -322,7 +328,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
                emergencyOnly, availableServices, cellIdentity, rplmn,
                new VoiceSpecificRegistrationInfo(cssSupported, roamingIndicator,
                        systemIsInPrl, defaultRoamingIndicator), null);
                        systemIsInPrl, defaultRoamingIndicator), null, false);
    }

    /**
@@ -344,7 +350,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
                        .setNrAvailable(isNrAvailable)
                        .setEnDcAvailable(isEndcAvailable)
                        .setVopsSupportInfo(vopsSupportInfo)
                        .build());
                        .build(), false);
    }

    private NetworkRegistrationInfo(Parcel source) {
@@ -366,6 +372,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        mNrState = source.readInt();
        mRplmn = source.readString();
        mIsUsingCarrierAggregation = source.readBoolean();
        mIsNonTerrestrialNetwork = source.readBoolean();
    }

    /**
@@ -382,6 +389,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        mRoamingType = nri.mRoamingType;
        mAccessNetworkTechnology = nri.mAccessNetworkTechnology;
        mIsUsingCarrierAggregation = nri.mIsUsingCarrierAggregation;
        mIsNonTerrestrialNetwork = nri.mIsNonTerrestrialNetwork;
        mRejectCause = nri.mRejectCause;
        mEmergencyOnly = nri.mEmergencyOnly;
        mAvailableServices = new ArrayList<>(nri.mAvailableServices);
@@ -657,6 +665,27 @@ public final class NetworkRegistrationInfo implements Parcelable {
        return mIsUsingCarrierAggregation;
    }

    /**
     * Set whether the network is a non-terrestrial network.
     *
     * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network
     *                                            else {@code false}.
     * @hide
     */
    public void setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork) {
        mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;
    }

    /**
     * Get whether the network is a non-terrestrial network.
     *
     * @return {@code true} if network is a non-terrestrial network else {@code false}.
     * @hide
     */
    public boolean isNonTerrestrialNetwork() {
        return mIsNonTerrestrialNetwork;
    }

    /**
     * @hide
     */
@@ -769,6 +798,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
                        ? nrStateToString(mNrState) : "****")
                .append(" rRplmn=").append(mRplmn)
                .append(" isUsingCarrierAggregation=").append(mIsUsingCarrierAggregation)
                .append(" isNonTerrestrialNetwork=").append(mIsNonTerrestrialNetwork)
                .append("}").toString();
    }

@@ -777,7 +807,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        return Objects.hash(mDomain, mTransportType, mRegistrationState, mNetworkRegistrationState,
                mRoamingType, mAccessNetworkTechnology, mRejectCause, mEmergencyOnly,
                mAvailableServices, mCellIdentity, mVoiceSpecificInfo, mDataSpecificInfo, mNrState,
                mRplmn, mIsUsingCarrierAggregation);
                mRplmn, mIsUsingCarrierAggregation, mIsNonTerrestrialNetwork);
    }

    @Override
@@ -803,7 +833,8 @@ public final class NetworkRegistrationInfo implements Parcelable {
                && Objects.equals(mVoiceSpecificInfo, other.mVoiceSpecificInfo)
                && Objects.equals(mDataSpecificInfo, other.mDataSpecificInfo)
                && TextUtils.equals(mRplmn, other.mRplmn)
                && mNrState == other.mNrState;
                && mNrState == other.mNrState
                && mIsNonTerrestrialNetwork == other.mIsNonTerrestrialNetwork;
    }

    /**
@@ -827,6 +858,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        dest.writeInt(mNrState);
        dest.writeString(mRplmn);
        dest.writeBoolean(mIsUsingCarrierAggregation);
        dest.writeBoolean(mIsNonTerrestrialNetwork);
    }

    /**
@@ -936,6 +968,8 @@ public final class NetworkRegistrationInfo implements Parcelable {
        @Nullable
        private VoiceSpecificRegistrationInfo mVoiceSpecificRegistrationInfo;

        private boolean mIsNonTerrestrialNetwork;

        /**
         * Default constructor for Builder.
         */
@@ -964,6 +998,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
                mVoiceSpecificRegistrationInfo = new VoiceSpecificRegistrationInfo(
                        nri.mVoiceSpecificInfo);
            }
            mIsNonTerrestrialNetwork = nri.mIsNonTerrestrialNetwork;
        }

        /**
@@ -1110,6 +1145,19 @@ public final class NetworkRegistrationInfo implements Parcelable {
            return this;
        }

        /**
         * Set whether the network is a non-terrestrial network.
         *
         * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network
         *                                            else {@code false}.
         * @return The builder.
         * @hide
         */
        public @NonNull Builder setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork) {
            mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;
            return this;
        }

        /**
         * Build the NetworkRegistrationInfo.
         * @return the NetworkRegistrationInfo object.
@@ -1120,7 +1168,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
            return new NetworkRegistrationInfo(mDomain, mTransportType, mNetworkRegistrationState,
                    mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
                    mCellIdentity, mRplmn, mVoiceSpecificRegistrationInfo,
                    mDataSpecificRegistrationInfo);
                    mDataSpecificRegistrationInfo, mIsNonTerrestrialNetwork);
        }
    }
}
+15 −0
Original line number Diff line number Diff line
@@ -2250,4 +2250,19 @@ public class ServiceState implements Parcelable {
            return false;
        }
    }

    /**
     * Get whether device is connected to a non-terrestrial network.
     *
     * @return {@code true} if device is connected to a non-terrestrial network else {@code false}.
     * @hide
     */
    public boolean isUsingNonTerrestrialNetwork() {
        synchronized (mNetworkRegistrationInfos) {
            for (NetworkRegistrationInfo nri : mNetworkRegistrationInfos) {
                if (nri.isNonTerrestrialNetwork()) return true;
            }
        }
        return false;
    }
}