Fix API review issues for 5G Slicing feature

- Rename SlicingConfig and SlicingException to
  NetworkSlicingConfig and NetworkSlicingException
- Rename SlicingError to NetworkSlicingError
- add subclasses for NetworkSlicingException and remove getErrorCode()
- make isRadioInterfaceCapabilitySupported() public

Bug: 183714964
Bug: 183937956
Test: full build pass
    - make -j200 doc-comment-check-docs
    - atest TelephonyManagerTest#testGetNetworkSlicingConfiguration
    - atest RadioConfigResponseTest
Change-Id: I4326b230c09adcf732f4271f3044d69c1ae5958c
diff --git a/core/api/current.txt b/core/api/current.txt
index 10c4a4f..aec2d6b 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -42593,7 +42593,7 @@
     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 @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getNetworkSlicingConfiguration(@NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.telephony.data.NetworkSlicingConfig,android.telephony.TelephonyManager.NetworkSlicingException>);
     method public String getNetworkSpecifier();
     method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType();
     method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
@@ -42644,6 +42644,7 @@
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isModemEnabledForSlot(int);
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int isMultiSimSupported();
     method public boolean isNetworkRoaming();
+    method public boolean isRadioInterfaceCapabilitySupported(@NonNull String);
     method public boolean isRttSupported();
     method public boolean isSmsCapable();
     method @Deprecated public boolean isTtyModeSupported();
@@ -42843,11 +42844,13 @@
     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 class TelephonyManager.ModemErrorException extends android.telephony.TelephonyManager.NetworkSlicingException {
+  }
+
+  public static class TelephonyManager.NetworkSlicingException extends java.lang.Exception {
+  }
+
+  public class TelephonyManager.TimeoutException extends android.telephony.TelephonyManager.NetworkSlicingException {
   }
 
   public abstract static class TelephonyManager.UssdResponseCallback {
@@ -43057,6 +43060,15 @@
     method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setStatus(int);
   }
 
+  public final class NetworkSlicingConfig implements android.os.Parcelable {
+    ctor public NetworkSlicingConfig();
+    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.NetworkSlicingConfig> CREATOR;
+  }
+
   public final class RouteSelectionDescriptor implements android.os.Parcelable {
     method public int describeContents();
     method @NonNull public java.util.List<java.lang.String> getDataNetworkName();
@@ -43074,15 +43086,6 @@
     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();
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 40f26e8..fbb25e6 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -11926,7 +11926,6 @@
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook();
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isOpportunisticNetworkEnabled();
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String);
-    method public boolean isRadioInterfaceCapabilitySupported(@NonNull String);
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn();
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isTetheringApnRequired();
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 75c8031..6b0ae8b 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -90,7 +90,7 @@
 import android.telephony.VisualVoicemailService.VisualVoicemailTask;
 import android.telephony.data.ApnSetting;
 import android.telephony.data.ApnSetting.MvnoType;
-import android.telephony.data.SlicingConfig;
+import android.telephony.data.NetworkSlicingConfig;
 import android.telephony.emergency.EmergencyNumber;
 import android.telephony.emergency.EmergencyNumber.EmergencyServiceCategories;
 import android.telephony.gba.UaSecurityProtocolIdentifier;
@@ -15066,13 +15066,20 @@
     public static final String CAPABILITY_SLICING_CONFIG_SUPPORTED =
             "CAPABILITY_SLICING_CONFIG_SUPPORTED";
 
-    /** @hide */
+    /**
+     * A list of the radio interface capability values with public valid constants.
+     *
+     * Here is a related list for the systemapi-only valid constants:
+     *     CAPABILITY_SECONDARY_LINK_BANDWIDTH_VISIBLE
+     *     CAPABILITY_ALLOWED_NETWORK_TYPES_USED
+     *     CAPABILITY_NR_DUAL_CONNECTIVITY_CONFIGURATION_AVAILABLE
+     *     CAPABILITY_THERMAL_MITIGATION_DATA_THROTTLING
+     *
+     * @hide
+     * TODO(b/185508047): Doc generation for mixed public/systemapi StringDefs formats badly.
+     */
     @Retention(RetentionPolicy.SOURCE)
     @StringDef(prefix = "CAPABILITY_", value = {
-            CAPABILITY_SECONDARY_LINK_BANDWIDTH_VISIBLE,
-            CAPABILITY_ALLOWED_NETWORK_TYPES_USED,
-            CAPABILITY_NR_DUAL_CONNECTIVITY_CONFIGURATION_AVAILABLE,
-            CAPABILITY_THERMAL_MITIGATION_DATA_THROTTLING,
             CAPABILITY_SLICING_CONFIG_SUPPORTED,
     })
     public @interface RadioInterfaceCapability {}
@@ -15084,10 +15091,7 @@
      *
      * @param capability the name of the capability to check for
      * @return the availability of the capability
-     *
-     * @hide
      */
-    @SystemApi
     public boolean isRadioInterfaceCapabilitySupported(
             @NonNull @RadioInterfaceCapability String capability) {
         try {
@@ -15671,7 +15675,7 @@
      * Exception that may be supplied to the callback in {@link #getNetworkSlicingConfiguration} if
      * something goes awry.
      */
-    public static class SlicingException extends Exception {
+    public static class NetworkSlicingException extends Exception {
         /**
          * Getting the current slicing configuration successfully. Used internally only.
          * @hide
@@ -15680,11 +15684,13 @@
 
         /**
          * The system timed out waiting for a response from the Radio.
+         * @hide
          */
         public static final int ERROR_TIMEOUT = 1;
 
         /**
          * The modem returned a failure.
+         * @hide
          */
         public static final int ERROR_MODEM_ERROR = 2;
 
@@ -15694,20 +15700,44 @@
                 ERROR_MODEM_ERROR,
         })
         @Retention(RetentionPolicy.SOURCE)
-        public @interface SlicingError {}
+        public @interface NetworkSlicingError {}
 
         private final int mErrorCode;
 
-        public SlicingException(@SlicingError int errorCode) {
+        /** @hide */
+        public NetworkSlicingException(@NetworkSlicingError int errorCode) {
             mErrorCode = errorCode;
         }
 
-        /**
-         * Fetches the error code associated with this exception.
-         * @return An error code.
-         */
-        public @SlicingError int getErrorCode() {
-            return mErrorCode;
+        @Override
+        public String toString() {
+            switch (mErrorCode) {
+                case ERROR_TIMEOUT: return "ERROR_TIMEOUT";
+                case ERROR_MODEM_ERROR: return "ERROR_MODEM_ERROR";
+                default: return "UNDEFINED";
+            }
+        }
+    }
+
+    /**
+     * Exception that is supplied to the callback in {@link #getNetworkSlicingConfiguration} if the
+     * system timed out waiting for a response from the Radio.
+     */
+    public class TimeoutException extends NetworkSlicingException {
+        /** @hide */
+        public TimeoutException(int errorCode) {
+            super(errorCode);
+        }
+    }
+
+    /**
+     * Exception that is supplied to the callback in {@link #getNetworkSlicingConfiguration} if the
+     * modem returned a failure.
+     */
+    public class ModemErrorException extends NetworkSlicingException {
+        /** @hide */
+        public ModemErrorException(int errorCode) {
+            super(errorCode);
         }
     }
 
@@ -15738,7 +15768,7 @@
     @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public void getNetworkSlicingConfiguration(
             @NonNull @CallbackExecutor Executor executor,
-            @NonNull OutcomeReceiver<SlicingConfig, SlicingException> callback) {
+            @NonNull OutcomeReceiver<NetworkSlicingConfig, NetworkSlicingException> callback) {
         Objects.requireNonNull(executor);
         Objects.requireNonNull(callback);
 
@@ -15750,12 +15780,17 @@
             telephony.getSlicingConfig(new ResultReceiver(null) {
                     @Override
                     protected void onReceiveResult(int resultCode, Bundle result) {
-                        if (resultCode != SlicingException.SUCCESS) {
+                        if (resultCode == NetworkSlicingException.ERROR_TIMEOUT) {
                             executor.execute(() -> callback.onError(
-                                    new SlicingException(resultCode)));
+                                    new TimeoutException(resultCode)));
+                            return;
+                        } else if (resultCode == NetworkSlicingException.ERROR_MODEM_ERROR) {
+                            executor.execute(() -> callback.onError(
+                                    new ModemErrorException(resultCode)));
                             return;
                         }
-                        SlicingConfig slicingConfig =
+
+                        NetworkSlicingConfig slicingConfig =
                                 result.getParcelable(KEY_SLICING_CONFIG_HANDLE);
                         executor.execute(() -> callback.onResult(slicingConfig));
                     }
diff --git a/telephony/java/android/telephony/data/SlicingConfig.aidl b/telephony/java/android/telephony/data/NetworkSlicingConfig.aidl
similarity index 95%
rename from telephony/java/android/telephony/data/SlicingConfig.aidl
rename to telephony/java/android/telephony/data/NetworkSlicingConfig.aidl
index ad93d8c..cd4a8f1e4 100644
--- a/telephony/java/android/telephony/data/SlicingConfig.aidl
+++ b/telephony/java/android/telephony/data/NetworkSlicingConfig.aidl
@@ -16,4 +16,4 @@
 
 package android.telephony.data;
 
-parcelable SlicingConfig;
+parcelable NetworkSlicingConfig;
diff --git a/telephony/java/android/telephony/data/SlicingConfig.java b/telephony/java/android/telephony/data/NetworkSlicingConfig.java
similarity index 83%
rename from telephony/java/android/telephony/data/SlicingConfig.java
rename to telephony/java/android/telephony/data/NetworkSlicingConfig.java
index 990e4d2..dec787f 100644
--- a/telephony/java/android/telephony/data/SlicingConfig.java
+++ b/telephony/java/android/telephony/data/NetworkSlicingConfig.java
@@ -28,22 +28,22 @@
 /**
  * Represents a slicing configuration
  */
-public final class SlicingConfig implements Parcelable {
+public final class NetworkSlicingConfig implements Parcelable {
     private final List<UrspRule> mUrspRules;
     private final List<NetworkSliceInfo> mSliceInfo;
 
-    public SlicingConfig() {
+    public NetworkSlicingConfig() {
         mUrspRules = new ArrayList<UrspRule>();
         mSliceInfo = new ArrayList<NetworkSliceInfo>();
     }
 
     /** @hide */
-    public SlicingConfig(android.hardware.radio.V1_6.SlicingConfig sc) {
+    public NetworkSlicingConfig(android.hardware.radio.V1_6.SlicingConfig sc) {
         this(sc.urspRules, sc.sliceInfo);
     }
 
     /** @hide */
-    public SlicingConfig(List<android.hardware.radio.V1_6.UrspRule> urspRules,
+    public NetworkSlicingConfig(List<android.hardware.radio.V1_6.UrspRule> urspRules,
             List<android.hardware.radio.V1_6.SliceInfo> sliceInfo) {
         mUrspRules = new ArrayList<UrspRule>();
         for (android.hardware.radio.V1_6.UrspRule ur : urspRules) {
@@ -69,7 +69,7 @@
     }
 
     /** @hide */
-    public SlicingConfig(Parcel p) {
+    public NetworkSlicingConfig(Parcel p) {
         mUrspRules = p.createTypedArrayList(UrspRule.CREATOR);
         mSliceInfo = p.createTypedArrayList(NetworkSliceInfo.CREATOR);
     }
@@ -96,16 +96,16 @@
         dest.writeTypedList(mSliceInfo, flags);
     }
 
-    public static final @NonNull Parcelable.Creator<SlicingConfig> CREATOR =
-            new Parcelable.Creator<SlicingConfig>() {
+    public static final @NonNull Parcelable.Creator<NetworkSlicingConfig> CREATOR =
+            new Parcelable.Creator<NetworkSlicingConfig>() {
                 @Override
-                public SlicingConfig createFromParcel(Parcel source) {
-                    return new SlicingConfig(source);
+                public NetworkSlicingConfig createFromParcel(Parcel source) {
+                    return new NetworkSlicingConfig(source);
                 }
 
                 @Override
-                public SlicingConfig[] newArray(int size) {
-                    return new SlicingConfig[size];
+                public NetworkSlicingConfig[] newArray(int size) {
+                    return new NetworkSlicingConfig[size];
                 }
             };
 
@@ -118,7 +118,7 @@
     public boolean equals(@Nullable Object o) {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
-        SlicingConfig that = (SlicingConfig) o;
+        NetworkSlicingConfig that = (NetworkSlicingConfig) o;
         return mUrspRules.size() == that.mUrspRules.size()
                 && mUrspRules.containsAll(that.mUrspRules)
                 && mSliceInfo.size() == that.mSliceInfo.size()