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

Commit 86dfd667 authored by Jack Nudelman's avatar Jack Nudelman
Browse files

Unhide Builder, getter, and constructor which includes radioAccessSpecifiers

Additionally, make new constructor public

Bug: 202317270

Test: make, presubmit tests

Change-Id: Id97fed90c313d1e8cde1059cf29296b6619dafea
parent eb233393
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -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.Integer> getBands();
    method @NonNull public java.util.List<java.lang.String> getMccMncs();
    method @NonNull public java.util.List<java.lang.String> getMccMncs();
    method public int getPriority();
    method public int getPriority();
    method @NonNull public java.util.List<android.telephony.RadioAccessSpecifier> getRadioAccessSpecifiers();
    method public int getSubId();
    method public int getSubId();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.AvailableNetworkInfo> CREATOR;
    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
    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 {
  public final class BarringInfo implements android.os.Parcelable {
    method public int describeContents();
    method public int describeContents();
    method @NonNull public android.telephony.BarringInfo.BarringServiceInfo getBarringServiceInfo(int);
    method @NonNull public android.telephony.BarringInfo.BarringServiceInfo getBarringServiceInfo(int);
+70 −36
Original line number Original line Diff line number Diff line
@@ -16,11 +16,14 @@


package android.telephony;
package android.telephony;


import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
import android.telephony.RadioAccessSpecifier;
import android.telephony.RadioAccessSpecifier;


import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Arrays;
import java.util.List;
import java.util.List;
@@ -32,7 +35,6 @@ import java.util.Objects;
 * Network Service when passed through {@link TelephonyManager#updateAvailableNetworks}
 * Network Service when passed through {@link TelephonyManager#updateAvailableNetworks}
 */
 */
public final class AvailableNetworkInfo implements Parcelable {
public final class AvailableNetworkInfo implements Parcelable {

    /*
    /*
     * Defines number of priority level high.
     * Defines number of priority level high.
     */
     */
@@ -48,6 +50,14 @@ public final class AvailableNetworkInfo implements Parcelable {
     */
     */
    public static final int PRIORITY_LOW = 3;
    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
     * subscription Id of the available network. This value must be one of the entry retrieved from
     * {@link SubscriptionManager#getOpportunisticSubscriptions}
     * {@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
     * for network selection. If there are more than one subId with highest priority then the
     * network with highest RSRP is chosen.
     * network with highest RSRP is chosen.
     */
     */
    private int mPriority;
    private @AvailableNetworkInfoPriority int mPriority;


    /**
    /**
     * Describes the List of PLMN ids (MCC-MNC) associated with mSubId.
     * 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.
     * Opportunistic network service will use these bands to scan.
     *
     *
     * When no specific bands are specified (empty array or null) CBRS band
     * When no specific bands are specified (empty array or null) CBRS band
     * {@link AccessNetworkConstants.EutranBand.BAND_48
     * {@link AccessNetworkConstants.EutranBand.BAND_48} will be used for network scan.
     * } will be used for network scan.
     *
     *
     * See {@link AccessNetworkConstants} for details.
     * 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
     * If this entry is left empty, {@link RadioAcccessSpecifier}s with {@link AccessNetworkType}s
     * of {@link AccessNetworkConstants.AccessNetworkType.EUTRAN} and {@link
     * of {@link AccessNetworkConstants.AccessNetworkType.EUTRAN} and {@link
     * AccessNetworkConstants.AccessNetworkType.NGRAN} with bands 48 and 71 on each will be assumed
     * 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;
    private ArrayList<RadioAccessSpecifier> mRadioAccessSpecifiers;


@@ -117,6 +126,7 @@ public final class AvailableNetworkInfo implements Parcelable {
     * network with highest RSRP is chosen.
     * network with highest RSRP is chosen.
     * @return priority level
     * @return priority level
     */
     */
    @AvailableNetworkInfoPriority
    public int getPriority() {
    public int getPriority() {
        return mPriority;
        return mPriority;
    }
    }
@@ -149,15 +159,9 @@ public final class AvailableNetworkInfo implements Parcelable {
     * Returns a list of {@link RadioAccessSpecifier} associated with the available network.
     * Returns a list of {@link RadioAccessSpecifier} associated with the available network.
     * Opportunistic network service will use this to determine which bands to scan for.
     * 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.
     * @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();
        return (List<RadioAccessSpecifier>) mRadioAccessSpecifiers.clone();
    }
    }


@@ -193,9 +197,9 @@ public final class AvailableNetworkInfo implements Parcelable {
    }
    }


    /** @hide */
    /** @hide */
    private AvailableNetworkInfo(int subId, int priority, @NonNull List<String> mccMncs,
    private AvailableNetworkInfo(int subId, @AvailableNetworkInfoPriority int priority,
            @NonNull List<Integer> bands, @NonNull List<RadioAccessSpecifier>
            @NonNull List<String> mccMncs, @NonNull List<Integer> bands,
            radioAccessSpecifiers) {
            @NonNull List<RadioAccessSpecifier> radioAccessSpecifiers) {
        mSubId = subId;
        mSubId = subId;
        mPriority = priority;
        mPriority = priority;
        mMccMncs = new ArrayList<String>(mccMncs);
        mMccMncs = new ArrayList<String>(mccMncs);
@@ -261,27 +265,39 @@ public final class AvailableNetworkInfo implements Parcelable {
     *
     *
     * <pre><code>
     * <pre><code>
     *
     *
     * AvailableNetworkInfo aNI = new AvailableNetworkInfo.Builder()
     * AvailableNetworkInfo aNI = new AvailableNetworkInfo.Builder(subId)
     *     .setSubId(1)
     *     .setPriority(AvailableNetworkInfo.PRIORITY_MED)
     *     .setPriority(AvailableNetworkInfo.PRIORITY_MED)
     *     .setRadioAccessSpecifiers(radioAccessSpecifiers)
     *     .setMccMncs(mccMncs)
     *     .build();
     *     .build();
     * </code></pre>
     * </code></pre>
     *
     * @hide
     */
     */
    public static final class Builder {
    public static final class Builder {
        private int mSubId = Integer.MIN_VALUE;
        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<String> mMccMncs = new ArrayList<>();
        private ArrayList<Integer> mBands = new ArrayList<>();
        private ArrayList<RadioAccessSpecifier> mRadioAccessSpecifiers = 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;
            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
            if (priority > AvailableNetworkInfo.PRIORITY_LOW
                    || priority < AvailableNetworkInfo.PRIORITY_HIGH) {
                    || priority < AvailableNetworkInfo.PRIORITY_HIGH) {
                throw new IllegalArgumentException("A valid priority must be set");
                throw new IllegalArgumentException("A valid priority must be set");
@@ -290,30 +306,48 @@ public final class AvailableNetworkInfo implements Parcelable {
            return this;
            return this;
        }
        }


        public @NonNull Builder setMccMncs(@NonNull ArrayList<String> mccMncs) {
        /**
            Objects.requireNonNull(mccMncs, "A non-null ArrayList of mccmncs must be set. An empty "
         * Sets the list of mccmncs associated with the subscription id.
                    + "list is still accepted. Please read documentation in "
         *
                    + "AvailableNetworkService to see consequences of an empty Arraylist.");
         * @param mccMncs nonull list of mccmncs. An empty List is still accepted. Please read
            mMccMncs = mccMncs;
         * 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;
            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(
        public @NonNull Builder setRadioAccessSpecifiers(
                @NonNull ArrayList<RadioAccessSpecifier> radioAccessSpecifiers) {
                @NonNull List<RadioAccessSpecifier> radioAccessSpecifiers) {
            Objects.requireNonNull(radioAccessSpecifiers, "A non-null ArrayList of "
            Objects.requireNonNull(radioAccessSpecifiers, "A non-null List of "
                    + "RadioAccessSpecifiers must be set. An empty list is still accepted. Please "
                    + "RadioAccessSpecifiers must be set. An empty List is still accepted. Please "
                    + "read documentation in AvailableNetworkService to see consequences of an "
                    + "read documentation in AvailableNetworkInfo to see consequences of an "
                    + "empty Arraylist.");
                    + "empty List.");
            mRadioAccessSpecifiers = radioAccessSpecifiers;
            mRadioAccessSpecifiers = new ArrayList<>(radioAccessSpecifiers);
            return this;
            return this;
        }
        }


        /**
         * @return an AvailableNetworkInfo object with all the fields previously set by the Builder.
         */
        public @NonNull AvailableNetworkInfo build() {
        public @NonNull AvailableNetworkInfo build() {
            if (mSubId == Integer.MIN_VALUE) {
            if (mSubId == Integer.MIN_VALUE) {
                throw new IllegalArgumentException("A valid subId must be set");
                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);
                    mRadioAccessSpecifiers);
        }
        }
    }
    }