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

Commit 9ee89f17 authored by Hongbo Zeng's avatar Hongbo Zeng Committed by Sarah Chin
Browse files

Support getSlicingConfig() API for 5G Slicing Configuration

- add getSlicingConfig() API in TelephonyManager and ITelephony
- add Parcelable implmentations for RouteSelectionDescriptor,
  SlicingConfig, and UrspRule
- remove @hide and @SystemApi for TrafficDescriptor and
  NetworkSliceInfo to make them public

Bug: 178075247
Test: .
(1) run "atest TelephonyManagerTest#testGetSlicingConfig" for CTS result
[22/121] android.telephony.cts.TelephonyManagerTest#testGetSlicingConfig: PASSED (956ms)
(2) run "atest RILTest#testGetSlicingConfig" for RILTest result
[17/111] com.android.internal.telephony.RILTest#testGetSlicingConfig: PASSED (1ms)

Change-Id: I0addc2b22c11b13759e890d88f51490993fb72e1
Merged-In: I0addc2b22c11b13759e890d88f51490993fb72e1
parent 1c8976b8
Loading
Loading
Loading
Loading
+90 −0
Original line number Diff line number Diff line
@@ -41036,6 +41036,7 @@ package android.telephony {
    method public String getNetworkOperator();
    method public String getNetworkOperatorName();
    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public int getNetworkSelectionMode();
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getNetworkSlicingConfiguration(@NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.telephony.data.SlicingConfig,android.telephony.TelephonyManager.SlicingException>);
    method public String getNetworkSpecifier();
    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType();
    method @Deprecated public int getPhoneCount();
@@ -41269,6 +41270,13 @@ package android.telephony {
    field public static final int ERROR_TIMEOUT = 1; // 0x1
  }
  public static class TelephonyManager.SlicingException extends java.lang.Exception {
    ctor public TelephonyManager.SlicingException(int);
    method public int getErrorCode();
    field public static final int ERROR_MODEM_ERROR = 2; // 0x2
    field public static final int ERROR_TIMEOUT = 1; // 0x1
  }
  public abstract static class TelephonyManager.UssdResponseCallback {
    ctor public TelephonyManager.UssdResponseCallback();
    method public void onReceiveUssdResponse(android.telephony.TelephonyManager, String, CharSequence);
@@ -41444,6 +41452,88 @@ package android.telephony.data {
    method @NonNull public android.telephony.data.ApnSetting.Builder setUser(@Nullable String);
  }
  public final class NetworkSliceInfo implements android.os.Parcelable {
    method public int describeContents();
    method @IntRange(from=0xffffffff, to=0xfffffe) public int getMappedHplmnSliceDifferentiator();
    method public int getMappedHplmnSliceServiceType();
    method @IntRange(from=0xffffffff, to=0xfffffe) public int getSliceDifferentiator();
    method public int getSliceServiceType();
    method public int getStatus();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.NetworkSliceInfo> CREATOR;
    field public static final int SLICE_DIFFERENTIATOR_NO_SLICE = -1; // 0xffffffff
    field public static final int SLICE_SERVICE_TYPE_EMBB = 1; // 0x1
    field public static final int SLICE_SERVICE_TYPE_MIOT = 3; // 0x3
    field public static final int SLICE_SERVICE_TYPE_NONE = 0; // 0x0
    field public static final int SLICE_SERVICE_TYPE_URLLC = 2; // 0x2
    field public static final int SLICE_STATUS_ALLOWED = 2; // 0x2
    field public static final int SLICE_STATUS_CONFIGURED = 1; // 0x1
    field public static final int SLICE_STATUS_DEFAULT_CONFIGURED = 5; // 0x5
    field public static final int SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_PLMN = 3; // 0x3
    field public static final int SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_REGISTERED_AREA = 4; // 0x4
    field public static final int SLICE_STATUS_UNKNOWN = 0; // 0x0
  }
  public static final class NetworkSliceInfo.Builder {
    ctor public NetworkSliceInfo.Builder();
    method @NonNull public android.telephony.data.NetworkSliceInfo build();
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setMappedHplmnSliceDifferentiator(@IntRange(from=0xffffffff, to=0xfffffe) int);
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setMappedHplmnSliceServiceType(int);
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setSliceDifferentiator(@IntRange(from=0xffffffff, to=0xfffffe) int);
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setSliceServiceType(int);
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setStatus(int);
  }
  public final class RouteSelectionDescriptor implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public java.util.List<java.lang.String> getDataNetworkName();
    method @IntRange(from=0x0, to=0xff) public int getPrecedence();
    method public int getSessionType();
    method @NonNull public java.util.List<android.telephony.data.NetworkSliceInfo> getSliceInfo();
    method public int getSscMode();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.RouteSelectionDescriptor> CREATOR;
    field public static final int ROUTE_SSC_MODE_1 = 1; // 0x1
    field public static final int ROUTE_SSC_MODE_2 = 2; // 0x2
    field public static final int ROUTE_SSC_MODE_3 = 3; // 0x3
    field public static final int SESSION_TYPE_IPV4 = 0; // 0x0
    field public static final int SESSION_TYPE_IPV4V6 = 2; // 0x2
    field public static final int SESSION_TYPE_IPV6 = 1; // 0x1
  }
  public final class SlicingConfig implements android.os.Parcelable {
    ctor public SlicingConfig();
    method public int describeContents();
    method @NonNull public java.util.List<android.telephony.data.NetworkSliceInfo> getSliceInfo();
    method @NonNull public java.util.List<android.telephony.data.UrspRule> getUrspRules();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.SlicingConfig> CREATOR;
  }
  public final class TrafficDescriptor implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public String getDataNetworkName();
    method @Nullable public String getOsAppId();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.TrafficDescriptor> CREATOR;
  }
  public static final class TrafficDescriptor.Builder {
    ctor public TrafficDescriptor.Builder();
    method @NonNull public android.telephony.data.TrafficDescriptor build();
    method @NonNull public android.telephony.data.TrafficDescriptor.Builder setDataNetworkName(@NonNull String);
    method @NonNull public android.telephony.data.TrafficDescriptor.Builder setOsAppId(@NonNull String);
  }
  public final class UrspRule implements android.os.Parcelable {
    method public int describeContents();
    method @IntRange(from=0x0, to=0xff) public int getPrecedence();
    method @NonNull public java.util.List<android.telephony.data.RouteSelectionDescriptor> getRouteSelectionDescriptor();
    method @NonNull public java.util.List<android.telephony.data.TrafficDescriptor> getTrafficDescriptors();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.UrspRule> CREATOR;
  }
}
package android.telephony.emergency {
+0 −35
Original line number Diff line number Diff line
@@ -10800,32 +10800,6 @@ package android.telephony.data {
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.EpsBearerQosSessionAttributes> CREATOR;
  }
  public final class NetworkSliceInfo implements android.os.Parcelable {
    method public int describeContents();
    method @IntRange(from=android.telephony.data.NetworkSliceInfo.MIN_SLICE_DIFFERENTIATOR, to=android.telephony.data.NetworkSliceInfo.MAX_SLICE_DIFFERENTIATOR) public int getMappedHplmnSliceDifferentiator();
    method public int getMappedHplmnSliceServiceType();
    method @IntRange(from=android.telephony.data.NetworkSliceInfo.MIN_SLICE_DIFFERENTIATOR, to=android.telephony.data.NetworkSliceInfo.MAX_SLICE_DIFFERENTIATOR) public int getSliceDifferentiator();
    method public int getSliceServiceType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.NetworkSliceInfo> CREATOR;
    field public static final int MAX_SLICE_DIFFERENTIATOR = 16777214; // 0xfffffe
    field public static final int MIN_SLICE_DIFFERENTIATOR = -1; // 0xffffffff
    field public static final int SLICE_DIFFERENTIATOR_NO_SLICE = -1; // 0xffffffff
    field public static final int SLICE_SERVICE_TYPE_EMBB = 1; // 0x1
    field public static final int SLICE_SERVICE_TYPE_MIOT = 3; // 0x3
    field public static final int SLICE_SERVICE_TYPE_NONE = 0; // 0x0
    field public static final int SLICE_SERVICE_TYPE_URLLC = 2; // 0x2
  }
  public static final class NetworkSliceInfo.Builder {
    ctor public NetworkSliceInfo.Builder();
    method @NonNull public android.telephony.data.NetworkSliceInfo build();
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setMappedHplmnSliceDifferentiator(@IntRange(from=android.telephony.data.NetworkSliceInfo.MIN_SLICE_DIFFERENTIATOR, to=android.telephony.data.NetworkSliceInfo.MAX_SLICE_DIFFERENTIATOR) int);
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setMappedHplmnSliceServiceType(int);
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setSliceDifferentiator(@IntRange(from=android.telephony.data.NetworkSliceInfo.MIN_SLICE_DIFFERENTIATOR, to=android.telephony.data.NetworkSliceInfo.MAX_SLICE_DIFFERENTIATOR) int);
    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setSliceServiceType(int);
  }
  public final class NrQosSessionAttributes implements android.os.Parcelable android.net.QosSessionAttributes {
    method public int describeContents();
    method @NonNull public java.time.Duration getBitRateWindowDuration();
@@ -10882,15 +10856,6 @@ package android.telephony.data {
    method @NonNull public android.telephony.data.ThrottleStatus.Builder setTransportType(int);
  }
  public final class TrafficDescriptor implements android.os.Parcelable {
    ctor public TrafficDescriptor(@Nullable String, @Nullable String);
    method public int describeContents();
    method @Nullable public String getDnn();
    method @Nullable public String getOsAppId();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.TrafficDescriptor> CREATOR;
  }
}
package android.telephony.euicc {
+93 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ import android.telephony.CallForwardingInfo.CallForwardingReason;
import android.telephony.VisualVoicemailService.VisualVoicemailTask;
import android.telephony.data.ApnSetting;
import android.telephony.data.ApnSetting.MvnoType;
import android.telephony.data.SlicingConfig;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.emergency.EmergencyNumber.EmergencyServiceCategories;
import android.telephony.gba.UaSecurityProtocolIdentifier;
@@ -15221,4 +15222,96 @@ public class TelephonyManager {
            return PhoneCapability.DEFAULT_SSSS_CAPABILITY;
        }
    }
    /**
     * Exception that may be supplied to the callback in {@link #getNetworkSlicingConfiguration} if
     * something goes awry.
     */
    public static class SlicingException extends Exception {
        /**
         * Getting the current slicing configuration successfully. Used internally only.
         * @hide
         */
        public static final int SUCCESS = 0;
        /**
         * The system timed out waiting for a response from the Radio.
         */
        public static final int ERROR_TIMEOUT = 1;
        /**
         * The modem returned a failure.
         */
        public static final int ERROR_MODEM_ERROR = 2;
        /** @hide */
        @IntDef(prefix = {"ERROR_"}, value = {
                ERROR_TIMEOUT,
                ERROR_MODEM_ERROR,
        })
        @Retention(RetentionPolicy.SOURCE)
        public @interface SlicingError {}
        private final int mErrorCode;
        public SlicingException(@SlicingError int errorCode) {
            mErrorCode = errorCode;
        }
        /**
         * Fetches the error code associated with this exception.
         * @return An error code.
         */
        public @SlicingError int getErrorCode() {
            return mErrorCode;
        }
    }
    /** @hide */
    public static final String KEY_SLICING_CONFIG_HANDLE = "slicing_config_handle";
    /**
     * Request to get the current slicing configuration including URSP rules and
     * NSSAIs (configured, allowed and rejected).
     *
     * This method can be invoked if one of the following requirements is met:
     * <ul>
     *     <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
     *     is a privileged permission that can only be granted to apps preloaded on the device.
     *     <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
     * </ul>
     *
     * @param executor the executor on which callback will be invoked.
     * @param callback a callback to receive the current slicing configuration.
     */
    @SuppressAutoDoc // No support for carrier privileges (b/72967236).
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public void getNetworkSlicingConfiguration(
            @NonNull @CallbackExecutor Executor executor,
            @NonNull OutcomeReceiver<SlicingConfig, SlicingException> callback) {
        Objects.requireNonNull(executor);
        Objects.requireNonNull(callback);
        try {
            ITelephony telephony = getITelephony();
            if (telephony == null) {
                throw new IllegalStateException("telephony service is null.");
            }
            telephony.getSlicingConfig(new ResultReceiver(null) {
                    @Override
                    protected void onReceiveResult(int resultCode, Bundle result) {
                        if (resultCode != SlicingException.SUCCESS) {
                            executor.execute(() -> callback.onError(
                                    new SlicingException(resultCode)));
                            return;
                        }
                        SlicingConfig slicingConfig =
                                result.getParcelable(KEY_SLICING_CONFIG_HANDLE);
                        executor.execute(() -> callback.onResult(slicingConfig));
                    }
            });
        } catch (RemoteException ex) {
            ex.rethrowAsRuntimeException();
        }
    }
}
+120 −15
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ package android.telephony.data;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;

@@ -35,10 +33,7 @@ import java.util.Objects;
 * SliceServiceType defines the type of service provided by the slice, and SliceDifferentiator is
 * used to differentiate between multiple slices of the same type. If the devices is not on HPLMN,
 * the mappedHplmn versions of these 2 fields indicate the corresponding values in HPLMN.
 *
 * @hide
 */
@SystemApi
public final class NetworkSliceInfo implements Parcelable {
    /**
     * When set on a Slice Differentiator, this value indicates that there is no corresponding
@@ -68,14 +63,14 @@ public final class NetworkSliceInfo implements Parcelable {

    /**
     * The min acceptable value for a Slice Differentiator
     * @hide
     */
    @SuppressLint("MinMaxConstant")
    public static final int MIN_SLICE_DIFFERENTIATOR = -1;

    /**
     * The max acceptable value for a Slice Differentiator
     * @hide
     */
    @SuppressLint("MinMaxConstant")
    public static final int MAX_SLICE_DIFFERENTIATOR = 0xFFFFFE;

    /** @hide */
@@ -88,6 +83,62 @@ public final class NetworkSliceInfo implements Parcelable {
    @Retention(RetentionPolicy.SOURCE)
    public @interface SliceServiceType {}

    /**
     * The slice status is unknown. This can happen during IWLAN->cellular handover when the
     * NetworkSliceInfo is received over IWLAN.
     */
    public static final int SLICE_STATUS_UNKNOWN = 0;

    /**
     * The slice is configured but not allowed or rejected yet.
     */
    public static final int SLICE_STATUS_CONFIGURED = 1;

    /**
     * The slice is allowed to be used.
     */
    public static final int SLICE_STATUS_ALLOWED = 2;

    /**
     * The slice is rejected because not available in PLMN.
     */
    public static final int SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_PLMN = 3;

    /**
     * The slice is rejected because not available in registered area.
     */
    public static final int SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_REGISTERED_AREA = 4;

    /**
     * The slice is configured by home operator(HPLMN) in default and is used if configured/allowed
     * slices are not available for the serving PLMN.
     */
    public static final int SLICE_STATUS_DEFAULT_CONFIGURED = 5;

    /**
     * The min acceptable value for a slice status.
     * @hide
     */
    public static final int MIN_SLICE_STATUS = SLICE_STATUS_UNKNOWN;

    /**
     * The max acceptable value for a slice status.
     * @hide
     */
    public static final int MAX_SLICE_STATUS = SLICE_STATUS_DEFAULT_CONFIGURED;

    /** @hide */
    @IntDef(prefix = { "SLICE_STATUS_" }, value = {
            SLICE_STATUS_UNKNOWN,
            SLICE_STATUS_CONFIGURED,
            SLICE_STATUS_ALLOWED,
            SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_PLMN,
            SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_REGISTERED_AREA,
            SLICE_STATUS_DEFAULT_CONFIGURED,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SliceStatus {}


    @SliceServiceType
    private final int mSliceServiceType;
@@ -97,14 +148,18 @@ public final class NetworkSliceInfo implements Parcelable {
    private final int mMappedHplmnSliceServiceType;
    @IntRange(from = MIN_SLICE_DIFFERENTIATOR, to = MAX_SLICE_DIFFERENTIATOR)
    private final int mMappedHplmnSliceDifferentiator;
    @SliceStatus
    @IntRange(from = MIN_SLICE_STATUS, to = MAX_SLICE_STATUS)
    private final int mStatus;

    private NetworkSliceInfo(@SliceServiceType int sliceServiceType,
            int sliceDifferentiator, int mappedHplmnSliceServiceType,
            int mappedHplmnSliceDifferentiator) {
            int mappedHplmnSliceDifferentiator, int status) {
        mSliceServiceType = sliceServiceType;
        mSliceDifferentiator = sliceDifferentiator;
        mMappedHplmnSliceDifferentiator = mappedHplmnSliceDifferentiator;
        mMappedHplmnSliceServiceType = mappedHplmnSliceServiceType;
        mStatus = status;
    }

    /**
@@ -157,11 +212,21 @@ public final class NetworkSliceInfo implements Parcelable {
        return mMappedHplmnSliceDifferentiator;
    }

    /**
     * Field to indicate the current status of the slice.
     * @return the current status for this slice info.
     */
    @SliceStatus
    public int getStatus() {
        return mStatus;
    }

    private NetworkSliceInfo(@NonNull Parcel in) {
        mSliceServiceType = in.readInt();
        mSliceDifferentiator = in.readInt();
        mMappedHplmnSliceServiceType = in.readInt();
        mMappedHplmnSliceDifferentiator = in.readInt();
        mStatus = in.readInt();
    }

    @Override
@@ -175,6 +240,7 @@ public final class NetworkSliceInfo implements Parcelable {
        dest.writeInt(mSliceDifferentiator);
        dest.writeInt(mMappedHplmnSliceServiceType);
        dest.writeInt(mMappedHplmnSliceDifferentiator);
        dest.writeInt(mStatus);
    }

    public static final @android.annotation.NonNull Parcelable.Creator<NetworkSliceInfo> CREATOR =
@@ -200,6 +266,7 @@ public final class NetworkSliceInfo implements Parcelable {
                + ", mMappedHplmnSliceServiceType="
                + sliceServiceTypeToString(mMappedHplmnSliceServiceType)
                + ", mMappedHplmnSliceDifferentiator=" + mMappedHplmnSliceDifferentiator
                + ", mStatus=" + sliceStatusToString(mStatus)
                + '}';
    }

@@ -218,6 +285,25 @@ public final class NetworkSliceInfo implements Parcelable {
        }
    }

    private static String sliceStatusToString(@SliceStatus int sliceStatus) {
        switch(sliceStatus) {
            case SLICE_STATUS_UNKNOWN:
                return "UNKNOWN";
            case SLICE_STATUS_CONFIGURED:
                return "CONFIGURED";
            case SLICE_STATUS_ALLOWED:
                return "ALLOWED";
            case SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_PLMN:
                return "REJECTED_NOT_AVAILABLE_IN_PLMN";
            case SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_REGISTERED_AREA:
                return "REJECTED_NOT_AVAILABLE_IN_REGISTERED_AREA";
            case SLICE_STATUS_DEFAULT_CONFIGURED:
                return "DEFAULT_CONFIGURED";
            default:
                return Integer.toString(sliceStatus);
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
@@ -226,13 +312,14 @@ public final class NetworkSliceInfo implements Parcelable {
        return mSliceServiceType == sliceInfo.mSliceServiceType
                && mSliceDifferentiator == sliceInfo.mSliceDifferentiator
                && mMappedHplmnSliceServiceType == sliceInfo.mMappedHplmnSliceServiceType
                && mMappedHplmnSliceDifferentiator == sliceInfo.mMappedHplmnSliceDifferentiator;
                && mMappedHplmnSliceDifferentiator == sliceInfo.mMappedHplmnSliceDifferentiator
                && mStatus == sliceInfo.mStatus;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mSliceServiceType, mSliceDifferentiator, mMappedHplmnSliceServiceType,
                mMappedHplmnSliceDifferentiator);
                mMappedHplmnSliceDifferentiator, mStatus);
    }

    /**
@@ -257,6 +344,9 @@ public final class NetworkSliceInfo implements Parcelable {
        private int mMappedHplmnSliceServiceType = SLICE_SERVICE_TYPE_NONE;
        @IntRange(from = MIN_SLICE_DIFFERENTIATOR, to = MAX_SLICE_DIFFERENTIATOR)
        private int mMappedHplmnSliceDifferentiator = SLICE_DIFFERENTIATOR_NO_SLICE;
        @SliceStatus
        @IntRange(from = MIN_SLICE_STATUS, to = MAX_SLICE_STATUS)
        private int mStatus = SLICE_STATUS_UNKNOWN;

        /**
         * Default constructor for Builder.
@@ -281,8 +371,7 @@ public final class NetworkSliceInfo implements Parcelable {
         * A value of {@link #SLICE_DIFFERENTIATOR_NO_SLICE} indicates that there is no
         * corresponding Slice.
         *
         * @throws IllegalArgumentException if the parameter is not between
         * {@link #MIN_SLICE_DIFFERENTIATOR} and {@link #MAX_SLICE_DIFFERENTIATOR}.
         * @throws IllegalArgumentException if the parameter is not in the expected range.
         *
         * @return The same instance of the builder.
         */
@@ -316,8 +405,7 @@ public final class NetworkSliceInfo implements Parcelable {
         * A value of {@link #SLICE_DIFFERENTIATOR_NO_SLICE} indicates that there is no
         * corresponding Slice of the HPLMN.
         *
         * @throws IllegalArgumentException if the parameter is not between
         * {@link #MIN_SLICE_DIFFERENTIATOR} and {@link #MAX_SLICE_DIFFERENTIATOR}.
         * @throws IllegalArgumentException if the parameter is not in the expected range.
         *
         * @return The same instance of the builder.
         */
@@ -333,6 +421,22 @@ public final class NetworkSliceInfo implements Parcelable {
            return this;
        }

        /**
         * Set the slice status.
         *
         * @throws IllegalArgumentException if the status is invalid.
         *
         * @return The same instance of the builder.
         */
        @NonNull
        public Builder setStatus(@SliceStatus int status) {
            if (status < MIN_SLICE_STATUS || status > MAX_SLICE_STATUS) {
                throw new IllegalArgumentException("The slice status is not valid");
            }
            this.mStatus = status;
            return this;
        }

        /**
         * Build the {@link NetworkSliceInfo}.
         *
@@ -341,7 +445,8 @@ public final class NetworkSliceInfo implements Parcelable {
        @NonNull
        public NetworkSliceInfo build() {
            return new NetworkSliceInfo(this.mSliceServiceType, this.mSliceDifferentiator,
                    this.mMappedHplmnSliceServiceType, this.mMappedHplmnSliceDifferentiator);
                    this.mMappedHplmnSliceServiceType, this.mMappedHplmnSliceDifferentiator,
                    this.mStatus);
        }
    }
}
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.data;

parcelable RouteSelectionDescriptor;
Loading