Add isNonTerrestrialNetwork apis in NetworkRegistrationInfo for satellite connectivity

Bug: 285189512
Test: Flashed build on raven-userdebug and performed basic functionality
tests,
atest NetworkRegistrationInfoTest,
atest ServiceStateTest

Change-Id: Idc106f26209c805cee898e7358574523617a3365
This commit is contained in:
Aishwarya Mallampati
2023-05-31 23:36:49 +00:00
committed by Aishwarya Mallamapti
parent e24254dea0
commit 4b8bfd8e71
4 changed files with 69 additions and 6 deletions

View File

@@ -44870,6 +44870,7 @@ package android.telephony {
method public boolean isNetworkRegistered();
method public boolean isNetworkRoaming();
method public boolean isNetworkSearching();
method public boolean isNonTerrestrialNetwork();
method @Deprecated public boolean isRegistered();
method @Deprecated public boolean isRoaming();
method @Deprecated public boolean isSearching();
@@ -45099,6 +45100,7 @@ package android.telephony {
method public boolean getRoaming();
method public int getState();
method public boolean isSearching();
method public boolean isUsingNonTerrestrialNetwork();
method public void setIsManualSelection(boolean);
method public void setOperatorName(String, String, String);
method public void setRoaming(boolean);

View File

@@ -14207,6 +14207,7 @@ package android.telephony {
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setCellIdentity(@Nullable android.telephony.CellIdentity);
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setDomain(int);
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setEmergencyOnly(boolean);
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setIsNonTerrestrialNetwork(boolean);
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRegisteredPlmn(@Nullable String);
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRegistrationState(int);
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRejectCause(int);

View File

@@ -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,26 @@ 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}.
*/
public boolean isNonTerrestrialNetwork() {
return mIsNonTerrestrialNetwork;
}
/**
* @hide
*/
@@ -769,6 +797,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 +806,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 +832,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 +857,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
dest.writeInt(mNrState);
dest.writeString(mRplmn);
dest.writeBoolean(mIsUsingCarrierAggregation);
dest.writeBoolean(mIsNonTerrestrialNetwork);
}
/**
@@ -936,6 +967,8 @@ public final class NetworkRegistrationInfo implements Parcelable {
@Nullable
private VoiceSpecificRegistrationInfo mVoiceSpecificRegistrationInfo;
private boolean mIsNonTerrestrialNetwork;
/**
* Default constructor for Builder.
*/
@@ -964,6 +997,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
mVoiceSpecificRegistrationInfo = new VoiceSpecificRegistrationInfo(
nri.mVoiceSpecificInfo);
}
mIsNonTerrestrialNetwork = nri.mIsNonTerrestrialNetwork;
}
/**
@@ -1110,6 +1144,18 @@ 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.
*/
public @NonNull Builder setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork) {
mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;
return this;
}
/**
* Build the NetworkRegistrationInfo.
* @return the NetworkRegistrationInfo object.
@@ -1120,7 +1166,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
return new NetworkRegistrationInfo(mDomain, mTransportType, mNetworkRegistrationState,
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
mCellIdentity, mRplmn, mVoiceSpecificRegistrationInfo,
mDataSpecificRegistrationInfo);
mDataSpecificRegistrationInfo, mIsNonTerrestrialNetwork);
}
}
}

View File

@@ -2250,4 +2250,18 @@ 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}.
*/
public boolean isUsingNonTerrestrialNetwork() {
synchronized (mNetworkRegistrationInfos) {
for (NetworkRegistrationInfo nri : mNetworkRegistrationInfos) {
if (nri.isNonTerrestrialNetwork()) return true;
}
}
return false;
}
}