Unhide Builder, getter, and constructor which includes radioAccessSpecifiers

Additionally, make new constructor public

Bug: 202317270

Test: make, presubmit tests

Change-Id: Id97fed90c313d1e8cde1059cf29296b6619dafea
This commit is contained in:
Jack Nudelman
2021-10-27 18:53:06 +00:00
parent eb2333936e
commit 86dfd6673d
2 changed files with 79 additions and 36 deletions

View File

@@ -40686,6 +40686,7 @@ package android.telephony {
method @NonNull public java.util.List<java.lang.Integer> getBands();
method @NonNull public java.util.List<java.lang.String> getMccMncs();
method public int getPriority();
method @NonNull public java.util.List<android.telephony.RadioAccessSpecifier> getRadioAccessSpecifiers();
method public int getSubId();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.AvailableNetworkInfo> CREATOR;
@@ -40694,6 +40695,14 @@ package android.telephony {
field public static final int PRIORITY_MED = 2; // 0x2
}
public static final class AvailableNetworkInfo.Builder {
ctor public AvailableNetworkInfo.Builder(int);
method @NonNull public android.telephony.AvailableNetworkInfo build();
method @NonNull public android.telephony.AvailableNetworkInfo.Builder setMccMncs(@NonNull java.util.List<java.lang.String>);
method @NonNull public android.telephony.AvailableNetworkInfo.Builder setPriority(int);
method @NonNull public android.telephony.AvailableNetworkInfo.Builder setRadioAccessSpecifiers(@NonNull java.util.List<android.telephony.RadioAccessSpecifier>);
}
public final class BarringInfo implements android.os.Parcelable {
method public int describeContents();
method @NonNull public android.telephony.BarringInfo.BarringServiceInfo getBarringServiceInfo(int);

View File

@@ -16,11 +16,14 @@
package android.telephony;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.RadioAccessSpecifier;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -32,7 +35,6 @@ import java.util.Objects;
* Network Service when passed through {@link TelephonyManager#updateAvailableNetworks}
*/
public final class AvailableNetworkInfo implements Parcelable {
/*
* Defines number of priority level high.
*/
@@ -48,6 +50,14 @@ public final class AvailableNetworkInfo implements Parcelable {
*/
public static final int PRIORITY_LOW = 3;
/** @hide */
@IntDef({
PRIORITY_HIGH,
PRIORITY_MED,
PRIORITY_LOW,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AvailableNetworkInfoPriority {}
/**
* subscription Id of the available network. This value must be one of the entry retrieved from
* {@link SubscriptionManager#getOpportunisticSubscriptions}
@@ -62,7 +72,7 @@ public final class AvailableNetworkInfo implements Parcelable {
* for network selection. If there are more than one subId with highest priority then the
* network with highest RSRP is chosen.
*/
private int mPriority;
private @AvailableNetworkInfoPriority int mPriority;
/**
* Describes the List of PLMN ids (MCC-MNC) associated with mSubId.
@@ -77,8 +87,7 @@ public final class AvailableNetworkInfo implements Parcelable {
* Opportunistic network service will use these bands to scan.
*
* When no specific bands are specified (empty array or null) CBRS band
* {@link AccessNetworkConstants.EutranBand.BAND_48
* } will be used for network scan.
* {@link AccessNetworkConstants.EutranBand.BAND_48} will be used for network scan.
*
* See {@link AccessNetworkConstants} for details.
*
@@ -94,7 +103,7 @@ public final class AvailableNetworkInfo implements Parcelable {
* If this entry is left empty, {@link RadioAcccessSpecifier}s with {@link AccessNetworkType}s
* of {@link AccessNetworkConstants.AccessNetworkType.EUTRAN} and {@link
* AccessNetworkConstants.AccessNetworkType.NGRAN} with bands 48 and 71 on each will be assumed
* by Opportunistic network service.
* by Opportunistic network service for a network scan.
*/
private ArrayList<RadioAccessSpecifier> mRadioAccessSpecifiers;
@@ -117,6 +126,7 @@ public final class AvailableNetworkInfo implements Parcelable {
* network with highest RSRP is chosen.
* @return priority level
*/
@AvailableNetworkInfoPriority
public int getPriority() {
return mPriority;
}
@@ -149,15 +159,9 @@ public final class AvailableNetworkInfo implements Parcelable {
* Returns a list of {@link RadioAccessSpecifier} associated with the available network.
* Opportunistic network service will use this to determine which bands to scan for.
*
* the returned value is one of {@link AccessNetworkConstants.AccessNetworkType}. When no
* specific access network type is specified, {@link RadioAccessSpecifier}s with {@link
* AccessNetworkType}s of {@link AccessNetworkConstants.AccessNetworkType.EUTRAN} and {@link
* AccessNetworkConstants.AccessNetworkType.NGRAN} with bands 48 and 71 on each will be assumed
* by Opportunistic network service.
* @return the access network type associated with the available network.
* @hide
*/
public List<RadioAccessSpecifier> getRadioAccessSpecifiers() {
public @NonNull List<RadioAccessSpecifier> getRadioAccessSpecifiers() {
return (List<RadioAccessSpecifier>) mRadioAccessSpecifiers.clone();
}
@@ -193,9 +197,9 @@ public final class AvailableNetworkInfo implements Parcelable {
}
/** @hide */
private AvailableNetworkInfo(int subId, int priority, @NonNull List<String> mccMncs,
@NonNull List<Integer> bands, @NonNull List<RadioAccessSpecifier>
radioAccessSpecifiers) {
private AvailableNetworkInfo(int subId, @AvailableNetworkInfoPriority int priority,
@NonNull List<String> mccMncs, @NonNull List<Integer> bands,
@NonNull List<RadioAccessSpecifier> radioAccessSpecifiers) {
mSubId = subId;
mPriority = priority;
mMccMncs = new ArrayList<String>(mccMncs);
@@ -261,27 +265,39 @@ public final class AvailableNetworkInfo implements Parcelable {
*
* <pre><code>
*
* AvailableNetworkInfo aNI = new AvailableNetworkInfo.Builder()
* .setSubId(1)
* AvailableNetworkInfo aNI = new AvailableNetworkInfo.Builder(subId)
* .setPriority(AvailableNetworkInfo.PRIORITY_MED)
* .setRadioAccessSpecifiers(radioAccessSpecifiers)
* .setMccMncs(mccMncs)
* .build();
* </code></pre>
*
* @hide
*/
public static final class Builder {
private int mSubId = Integer.MIN_VALUE;
private int mPriority = AvailableNetworkInfo.PRIORITY_LOW;
private @AvailableNetworkInfoPriority int mPriority = AvailableNetworkInfo.PRIORITY_LOW;
private ArrayList<String> mMccMncs = new ArrayList<>();
private ArrayList<Integer> mBands = new ArrayList<>();
private ArrayList<RadioAccessSpecifier> mRadioAccessSpecifiers = new ArrayList<>();
public @NonNull Builder setSubId(int subId) {
/**
*
*/
/**
* Creates an AvailableNetworkInfo Builder with specified subscription id.
*
* @param subId of the availableNetwork.
*/
public Builder(int subId) {
mSubId = subId;
return this;
}
public @NonNull Builder setPriority(int priority) {
/**
* Sets the priority for the subscription id.
*
* @param priority of the subscription id. See {@link AvailableNetworkInfo#getPriority} for
* more details
* @return the original Builder object.
*/
public @NonNull Builder setPriority(@AvailableNetworkInfoPriority int priority) {
if (priority > AvailableNetworkInfo.PRIORITY_LOW
|| priority < AvailableNetworkInfo.PRIORITY_HIGH) {
throw new IllegalArgumentException("A valid priority must be set");
@@ -290,30 +306,48 @@ public final class AvailableNetworkInfo implements Parcelable {
return this;
}
public @NonNull Builder setMccMncs(@NonNull ArrayList<String> mccMncs) {
Objects.requireNonNull(mccMncs, "A non-null ArrayList of mccmncs must be set. An empty "
+ "list is still accepted. Please read documentation in "
+ "AvailableNetworkService to see consequences of an empty Arraylist.");
mMccMncs = mccMncs;
/**
* Sets the list of mccmncs associated with the subscription id.
*
* @param mccMncs nonull list of mccmncs. An empty List is still accepted. Please read
* documentation in {@link AvailableNetworkInfo} to see consequences of an empty List.
* @return the original Builder object.
*/
public @NonNull Builder setMccMncs(@NonNull List<String> mccMncs) {
Objects.requireNonNull(mccMncs, "A non-null List of mccmncs must be set. An empty "
+ "List is still accepted. Please read documentation in "
+ "AvailableNetworkInfo to see consequences of an empty List.");
mMccMncs = new ArrayList<>(mccMncs);
return this;
}
/**
* Sets the list of mccmncs associated with the subscription id.
*
* @param radioAccessSpecifiers nonull list of radioAccessSpecifiers. An empty List is still
* accepted. Please read documentation in {@link AvailableNetworkInfo} to see
* consequences of an empty List.
* @return the original Builder object.
*/
public @NonNull Builder setRadioAccessSpecifiers(
@NonNull ArrayList<RadioAccessSpecifier> radioAccessSpecifiers) {
Objects.requireNonNull(radioAccessSpecifiers, "A non-null ArrayList of "
+ "RadioAccessSpecifiers must be set. An empty list is still accepted. Please "
+ "read documentation in AvailableNetworkService to see consequences of an "
+ "empty Arraylist.");
mRadioAccessSpecifiers = radioAccessSpecifiers;
@NonNull List<RadioAccessSpecifier> radioAccessSpecifiers) {
Objects.requireNonNull(radioAccessSpecifiers, "A non-null List of "
+ "RadioAccessSpecifiers must be set. An empty List is still accepted. Please "
+ "read documentation in AvailableNetworkInfo to see consequences of an "
+ "empty List.");
mRadioAccessSpecifiers = new ArrayList<>(radioAccessSpecifiers);
return this;
}
/**
* @return an AvailableNetworkInfo object with all the fields previously set by the Builder.
*/
public @NonNull AvailableNetworkInfo build() {
if (mSubId == Integer.MIN_VALUE) {
throw new IllegalArgumentException("A valid subId must be set");
}
return new AvailableNetworkInfo(mSubId, mPriority, mMccMncs, mBands,
return new AvailableNetworkInfo(mSubId, mPriority, mMccMncs, new ArrayList<>(),
mRadioAccessSpecifiers);
}
}