Return the RPLMN from NetworkRegistrationInfo
Add an API to get the RPLMN in network registration info.
This PLMN-ID is the one chosen from the PLMN IDs broadcast
by the cell for registration purposes.
Bug: 135921133
Test: make update-api && make offline-sdk-docs && make
&& atest FrameworksTelephonyTests
Change-Id: I82f9150e185d9809572d246b57ea42f14ad64f15
This commit is contained in:
@@ -47074,6 +47074,7 @@ package android.telephony {
|
|||||||
method @Nullable public android.telephony.CellIdentity getCellIdentity();
|
method @Nullable public android.telephony.CellIdentity getCellIdentity();
|
||||||
method public int getDomain();
|
method public int getDomain();
|
||||||
method public int getNrState();
|
method public int getNrState();
|
||||||
|
method @NonNull public String getRegisteredPlmn();
|
||||||
method public int getTransportType();
|
method public int getTransportType();
|
||||||
method public boolean isRegistered();
|
method public boolean isRegistered();
|
||||||
method public boolean isRoaming();
|
method public boolean isRoaming();
|
||||||
|
|||||||
@@ -11726,6 +11726,7 @@ package android.telephony {
|
|||||||
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setCellIdentity(@Nullable android.telephony.CellIdentity);
|
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 setDomain(int);
|
||||||
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setEmergencyOnly(boolean);
|
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setEmergencyOnly(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 setRegistrationState(int);
|
||||||
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRejectCause(int);
|
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRejectCause(int);
|
||||||
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int);
|
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int);
|
||||||
|
|||||||
@@ -3475,6 +3475,7 @@ package android.telephony {
|
|||||||
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setCellIdentity(@Nullable android.telephony.CellIdentity);
|
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 setDomain(int);
|
||||||
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setEmergencyOnly(boolean);
|
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setEmergencyOnly(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 setRegistrationState(int);
|
||||||
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRejectCause(int);
|
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRejectCause(int);
|
||||||
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int);
|
method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.telephony.AccessNetworkConstants.TransportType;
|
import android.telephony.AccessNetworkConstants.TransportType;
|
||||||
import android.telephony.Annotation.NetworkType;
|
import android.telephony.Annotation.NetworkType;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@@ -214,6 +215,9 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private DataSpecificRegistrationInfo mDataSpecificInfo;
|
private DataSpecificRegistrationInfo mDataSpecificInfo;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String mRplmn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param domain Network domain. Must be a {@link Domain}. For transport type
|
* @param domain Network domain. Must be a {@link Domain}. For transport type
|
||||||
* {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this must set to {@link #DOMAIN_PS}.
|
* {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this must set to {@link #DOMAIN_PS}.
|
||||||
@@ -234,13 +238,14 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
* @param availableServices The list of the supported services.
|
* @param availableServices The list of the supported services.
|
||||||
* @param cellIdentity The identity representing a unique cell or wifi AP. Set to null if the
|
* @param cellIdentity The identity representing a unique cell or wifi AP. Set to null if the
|
||||||
* information is not available.
|
* information is not available.
|
||||||
|
* @param rplmn the registered plmn or the last plmn for attempted registration if reg failed.
|
||||||
*/
|
*/
|
||||||
private NetworkRegistrationInfo(@Domain int domain, @TransportType int transportType,
|
private NetworkRegistrationInfo(@Domain int domain, @TransportType int transportType,
|
||||||
@RegistrationState int registrationState,
|
@RegistrationState int registrationState,
|
||||||
@NetworkType int accessNetworkTechnology, int rejectCause,
|
@NetworkType int accessNetworkTechnology, int rejectCause,
|
||||||
boolean emergencyOnly,
|
boolean emergencyOnly,
|
||||||
@Nullable @ServiceType List<Integer> availableServices,
|
@Nullable @ServiceType List<Integer> availableServices,
|
||||||
@Nullable CellIdentity cellIdentity) {
|
@Nullable CellIdentity cellIdentity, @Nullable String rplmn) {
|
||||||
mDomain = domain;
|
mDomain = domain;
|
||||||
mTransportType = transportType;
|
mTransportType = transportType;
|
||||||
mRegistrationState = registrationState;
|
mRegistrationState = registrationState;
|
||||||
@@ -253,6 +258,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
mCellIdentity = cellIdentity;
|
mCellIdentity = cellIdentity;
|
||||||
mEmergencyOnly = emergencyOnly;
|
mEmergencyOnly = emergencyOnly;
|
||||||
mNrState = NR_STATE_NONE;
|
mNrState = NR_STATE_NONE;
|
||||||
|
mRplmn = (rplmn == null) ? "" : rplmn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,11 +269,11 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
int registrationState, int accessNetworkTechnology,
|
int registrationState, int accessNetworkTechnology,
|
||||||
int rejectCause, boolean emergencyOnly,
|
int rejectCause, boolean emergencyOnly,
|
||||||
@Nullable List<Integer> availableServices,
|
@Nullable List<Integer> availableServices,
|
||||||
@Nullable CellIdentity cellIdentity, boolean cssSupported,
|
@Nullable CellIdentity cellIdentity, @Nullable String rplmn,
|
||||||
int roamingIndicator, int systemIsInPrl,
|
boolean cssSupported, int roamingIndicator, int systemIsInPrl,
|
||||||
int defaultRoamingIndicator) {
|
int defaultRoamingIndicator) {
|
||||||
this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
|
this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
|
||||||
emergencyOnly, availableServices, cellIdentity);
|
emergencyOnly, availableServices, cellIdentity, rplmn);
|
||||||
|
|
||||||
mVoiceSpecificInfo = new VoiceSpecificRegistrationInfo(cssSupported, roamingIndicator,
|
mVoiceSpecificInfo = new VoiceSpecificRegistrationInfo(cssSupported, roamingIndicator,
|
||||||
systemIsInPrl, defaultRoamingIndicator);
|
systemIsInPrl, defaultRoamingIndicator);
|
||||||
@@ -281,13 +287,13 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
int registrationState, int accessNetworkTechnology,
|
int registrationState, int accessNetworkTechnology,
|
||||||
int rejectCause, boolean emergencyOnly,
|
int rejectCause, boolean emergencyOnly,
|
||||||
@Nullable List<Integer> availableServices,
|
@Nullable List<Integer> availableServices,
|
||||||
@Nullable CellIdentity cellIdentity, int maxDataCalls,
|
@Nullable CellIdentity cellIdentity, @Nullable String rplmn,
|
||||||
boolean isDcNrRestricted, boolean isNrAvailable,
|
int maxDataCalls, boolean isDcNrRestricted,
|
||||||
boolean isEndcAvailable,
|
boolean isNrAvailable, boolean isEndcAvailable,
|
||||||
LteVopsSupportInfo lteVopsSupportInfo,
|
LteVopsSupportInfo lteVopsSupportInfo,
|
||||||
boolean isUsingCarrierAggregation) {
|
boolean isUsingCarrierAggregation) {
|
||||||
this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
|
this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
|
||||||
emergencyOnly, availableServices, cellIdentity);
|
emergencyOnly, availableServices, cellIdentity, rplmn);
|
||||||
mDataSpecificInfo = new DataSpecificRegistrationInfo(
|
mDataSpecificInfo = new DataSpecificRegistrationInfo(
|
||||||
maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable, lteVopsSupportInfo,
|
maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable, lteVopsSupportInfo,
|
||||||
isUsingCarrierAggregation);
|
isUsingCarrierAggregation);
|
||||||
@@ -310,6 +316,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
mDataSpecificInfo = source.readParcelable(
|
mDataSpecificInfo = source.readParcelable(
|
||||||
DataSpecificRegistrationInfo.class.getClassLoader());
|
DataSpecificRegistrationInfo.class.getClassLoader());
|
||||||
mNrState = source.readInt();
|
mNrState = source.readInt();
|
||||||
|
mRplmn = source.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -343,6 +350,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
mDataSpecificInfo = new DataSpecificRegistrationInfo(nri.mDataSpecificInfo);
|
mDataSpecificInfo = new DataSpecificRegistrationInfo(nri.mDataSpecificInfo);
|
||||||
}
|
}
|
||||||
mNrState = nri.mNrState;
|
mNrState = nri.mNrState;
|
||||||
|
mRplmn = nri.mRplmn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -394,6 +402,22 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
return mRegistrationState == REGISTRATION_STATE_NOT_REGISTERED_SEARCHING;
|
return mRegistrationState == REGISTRATION_STATE_NOT_REGISTERED_SEARCHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the PLMN-ID for this Network Registration, also known as the RPLMN.
|
||||||
|
*
|
||||||
|
* <p>If the device is registered, this will return the registered PLMN-ID. If registration
|
||||||
|
* has failed, then this will return the PLMN ID of the last attempted registration. If the
|
||||||
|
* device is not registered, or if is registered to a non-3GPP radio technology, then this
|
||||||
|
* will return an empty string.
|
||||||
|
*
|
||||||
|
* <p>See 3GPP TS 23.122 for further information about the Registered PLMN.
|
||||||
|
*
|
||||||
|
* @return the registered PLMN-ID or an empty string.
|
||||||
|
*/
|
||||||
|
@NonNull public String getRegisteredPlmn() {
|
||||||
|
return mRplmn;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if registered on roaming network, {@code false} otherwise.
|
* @return {@code true} if registered on roaming network, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
@@ -590,6 +614,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
.append(" voiceSpecificInfo=").append(mVoiceSpecificInfo)
|
.append(" voiceSpecificInfo=").append(mVoiceSpecificInfo)
|
||||||
.append(" dataSpecificInfo=").append(mDataSpecificInfo)
|
.append(" dataSpecificInfo=").append(mDataSpecificInfo)
|
||||||
.append(" nrState=").append(nrStateToString(mNrState))
|
.append(" nrState=").append(nrStateToString(mNrState))
|
||||||
|
.append(" rRplmn=").append(mRplmn)
|
||||||
.append("}").toString();
|
.append("}").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,7 +622,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mDomain, mTransportType, mRegistrationState, mRoamingType,
|
return Objects.hash(mDomain, mTransportType, mRegistrationState, mRoamingType,
|
||||||
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
|
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
|
||||||
mCellIdentity, mVoiceSpecificInfo, mDataSpecificInfo, mNrState);
|
mCellIdentity, mVoiceSpecificInfo, mDataSpecificInfo, mNrState, mRplmn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -620,6 +645,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
&& Objects.equals(mCellIdentity, other.mCellIdentity)
|
&& Objects.equals(mCellIdentity, other.mCellIdentity)
|
||||||
&& Objects.equals(mVoiceSpecificInfo, other.mVoiceSpecificInfo)
|
&& Objects.equals(mVoiceSpecificInfo, other.mVoiceSpecificInfo)
|
||||||
&& Objects.equals(mDataSpecificInfo, other.mDataSpecificInfo)
|
&& Objects.equals(mDataSpecificInfo, other.mDataSpecificInfo)
|
||||||
|
&& TextUtils.equals(mRplmn, other.mRplmn)
|
||||||
&& mNrState == other.mNrState;
|
&& mNrState == other.mNrState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,6 +667,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
dest.writeParcelable(mVoiceSpecificInfo, 0);
|
dest.writeParcelable(mVoiceSpecificInfo, 0);
|
||||||
dest.writeParcelable(mDataSpecificInfo, 0);
|
dest.writeParcelable(mDataSpecificInfo, 0);
|
||||||
dest.writeInt(mNrState);
|
dest.writeInt(mNrState);
|
||||||
|
dest.writeString(mRplmn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -741,6 +768,9 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private CellIdentity mCellIdentity;
|
private CellIdentity mCellIdentity;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String mRplmn = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for Builder.
|
* Default constructor for Builder.
|
||||||
*/
|
*/
|
||||||
@@ -854,6 +884,18 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the registered PLMN.
|
||||||
|
*
|
||||||
|
* @param rplmn the registered plmn.
|
||||||
|
*
|
||||||
|
* @return The same instance of the builder.
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setRegisteredPlmn(@Nullable String rplmn) {
|
||||||
|
mRplmn = (rplmn == null) ? "" : rplmn;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the NetworkRegistrationInfo.
|
* Build the NetworkRegistrationInfo.
|
||||||
* @return the NetworkRegistrationInfo object.
|
* @return the NetworkRegistrationInfo object.
|
||||||
@@ -863,7 +905,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
|
|||||||
public @NonNull NetworkRegistrationInfo build() {
|
public @NonNull NetworkRegistrationInfo build() {
|
||||||
return new NetworkRegistrationInfo(mDomain, mTransportType, mRegistrationState,
|
return new NetworkRegistrationInfo(mDomain, mTransportType, mRegistrationState,
|
||||||
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
|
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
|
||||||
mCellIdentity);
|
mCellIdentity, mRplmn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user