Expose EapConfig, IkeSessionParams & IkeSession to public

As required by API Council in b/148596690, IKE API should be
public because IKE library runs in the client process and it
is not feasible to restrict the code with permissions. In
addition, VCN also requires part of IKE API to be public for
configuring IKE and Child Sessions.

This CL:
- Keep EapSessionConfig#getEapMsChapV2onfig (missing "C") as
  @SystemApi and create another public API with the typo fixed
- Keep #getNetwork and #setNetwork as @SystemApi and add another
  setter and getter for caller provided Network
- Add @NonNull to IkeSessionParams#getRetransmissionTimeoutsMillis
- Make all other System APIs in EapSessionConfig, IkeSessionParams and
  IkeSession public APIs without any change
- Add @SuppressLint to work around API lint warnings
- Fix typos in documentation

Bug: 151984042
Test: FrameworksIkeTests, CtsIkeTestCases
Change-Id: I03bec2b6d37a602ddd89963c967f402e9e4f8e1b
diff --git a/api/current.txt b/api/current.txt
index 9d138d1..81a5d61 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1,4 +1,51 @@
 // Signature format: 2.0
+package android.net.eap {
+
+  public final class EapSessionConfig {
+    method @Nullable public android.net.eap.EapSessionConfig.EapAkaConfig getEapAkaConfig();
+    method @Nullable public android.net.eap.EapSessionConfig.EapAkaPrimeConfig getEapAkaPrimeConfig();
+    method @NonNull public byte[] getEapIdentity();
+    method @Nullable public android.net.eap.EapSessionConfig.EapMsChapV2Config getEapMsChapV2Config();
+    method @Nullable public android.net.eap.EapSessionConfig.EapSimConfig getEapSimConfig();
+  }
+
+  public static final class EapSessionConfig.Builder {
+    ctor public EapSessionConfig.Builder();
+    method @NonNull public android.net.eap.EapSessionConfig build();
+    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapAkaConfig(int, int);
+    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapAkaPrimeConfig(int, int, @NonNull String, boolean);
+    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapIdentity(@NonNull byte[]);
+    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapMsChapV2Config(@NonNull String, @NonNull String);
+    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapSimConfig(int, int);
+  }
+
+  public static class EapSessionConfig.EapAkaConfig extends android.net.eap.EapSessionConfig.EapUiccConfig {
+  }
+
+  public static class EapSessionConfig.EapAkaPrimeConfig extends android.net.eap.EapSessionConfig.EapAkaConfig {
+    method public boolean allowsMismatchedNetworkNames();
+    method @NonNull public String getNetworkName();
+  }
+
+  public abstract static class EapSessionConfig.EapMethodConfig {
+    method public int getMethodType();
+  }
+
+  public static class EapSessionConfig.EapMsChapV2Config extends android.net.eap.EapSessionConfig.EapMethodConfig {
+    method @NonNull public String getPassword();
+    method @NonNull public String getUsername();
+  }
+
+  public static class EapSessionConfig.EapSimConfig extends android.net.eap.EapSessionConfig.EapUiccConfig {
+  }
+
+  public abstract static class EapSessionConfig.EapUiccConfig extends android.net.eap.EapSessionConfig.EapMethodConfig {
+    method public int getAppType();
+    method public int getSubId();
+  }
+
+}
+
 package android.net.ipsec.ike {
 
   public final class ChildSaProposal extends android.net.ipsec.ike.SaProposal {
@@ -83,6 +130,15 @@
     method @NonNull public android.net.ipsec.ike.IkeSaProposal build();
   }
 
+  public final class IkeSession implements java.lang.AutoCloseable {
+    ctor public IkeSession(@NonNull android.content.Context, @NonNull android.net.ipsec.ike.IkeSessionParams, @NonNull android.net.ipsec.ike.ChildSessionParams, @NonNull java.util.concurrent.Executor, @NonNull android.net.ipsec.ike.IkeSessionCallback, @NonNull android.net.ipsec.ike.ChildSessionCallback);
+    method public void close();
+    method public void closeChildSession(@NonNull android.net.ipsec.ike.ChildSessionCallback);
+    method public void finalize();
+    method public void kill();
+    method public void openChildSession(@NonNull android.net.ipsec.ike.ChildSessionParams, @NonNull android.net.ipsec.ike.ChildSessionCallback);
+  }
+
   public interface IkeSessionCallback {
     method public void onClosed();
     method public void onClosedExceptionally(@NonNull android.net.ipsec.ike.exceptions.IkeException);
@@ -105,6 +161,77 @@
     method @NonNull public java.net.InetAddress getRemoteAddress();
   }
 
+  public final class IkeSessionParams {
+    method @NonNull public java.util.List<android.net.ipsec.ike.IkeSessionParams.IkeConfigRequest> getConfigurationRequests();
+    method @Nullable public android.net.Network getConfiguredNetwork();
+    method @IntRange(from=0x14, to=0x708) public int getDpdDelaySeconds();
+    method @IntRange(from=0x12c, to=0x15180) public int getHardLifetimeSeconds();
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig getLocalAuthConfig();
+    method @NonNull public android.net.ipsec.ike.IkeIdentification getLocalIdentification();
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig getRemoteAuthConfig();
+    method @NonNull public android.net.ipsec.ike.IkeIdentification getRemoteIdentification();
+    method @NonNull public int[] getRetransmissionTimeoutsMillis();
+    method @NonNull public java.util.List<android.net.ipsec.ike.IkeSaProposal> getSaProposals();
+    method @NonNull public String getServerHostname();
+    method @IntRange(from=0x78, to=0x15180) public int getSoftLifetimeSeconds();
+    method public boolean hasIkeOption(int);
+    field public static final int IKE_OPTION_ACCEPT_ANY_REMOTE_ID = 0; // 0x0
+    field public static final int IKE_OPTION_EAP_ONLY_AUTH = 1; // 0x1
+  }
+
+  public static final class IkeSessionParams.Builder {
+    ctor public IkeSessionParams.Builder(@NonNull android.content.Context);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder addIkeOption(int);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder addPcscfServerRequest(@NonNull java.net.InetAddress);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder addPcscfServerRequest(int);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder addSaProposal(@NonNull android.net.ipsec.ike.IkeSaProposal);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams build();
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder removeIkeOption(int);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setAuthDigitalSignature(@Nullable java.security.cert.X509Certificate, @NonNull java.security.cert.X509Certificate, @NonNull java.security.PrivateKey);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setAuthDigitalSignature(@Nullable java.security.cert.X509Certificate, @NonNull java.security.cert.X509Certificate, @NonNull java.util.List<java.security.cert.X509Certificate>, @NonNull java.security.PrivateKey);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setAuthEap(@Nullable java.security.cert.X509Certificate, @NonNull android.net.eap.EapSessionConfig);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setAuthPsk(@NonNull byte[]);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setConfiguredNetwork(@NonNull android.net.Network);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setDpdDelaySeconds(@IntRange(from=0x14, to=0x708) int);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setLifetimeSeconds(@IntRange(from=0x12c, to=0x15180) int, @IntRange(from=0x78, to=0x15180) int);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setLocalIdentification(@NonNull android.net.ipsec.ike.IkeIdentification);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setRemoteIdentification(@NonNull android.net.ipsec.ike.IkeIdentification);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setRetransmissionTimeoutsMillis(@NonNull int[]);
+    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setServerHostname(@NonNull String);
+  }
+
+  public static interface IkeSessionParams.ConfigRequestIpv4PcscfServer extends android.net.ipsec.ike.IkeSessionParams.IkeConfigRequest {
+    method @Nullable public java.net.Inet4Address getAddress();
+  }
+
+  public static interface IkeSessionParams.ConfigRequestIpv6PcscfServer extends android.net.ipsec.ike.IkeSessionParams.IkeConfigRequest {
+    method @Nullable public java.net.Inet6Address getAddress();
+  }
+
+  public abstract static class IkeSessionParams.IkeAuthConfig {
+  }
+
+  public static class IkeSessionParams.IkeAuthDigitalSignLocalConfig extends android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig {
+    method @NonNull public java.security.cert.X509Certificate getClientEndCertificate();
+    method @NonNull public java.util.List<java.security.cert.X509Certificate> getIntermediateCertificates();
+    method @NonNull public java.security.PrivateKey getPrivateKey();
+  }
+
+  public static class IkeSessionParams.IkeAuthDigitalSignRemoteConfig extends android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig {
+    method @Nullable public java.security.cert.X509Certificate getRemoteCaCert();
+  }
+
+  public static class IkeSessionParams.IkeAuthEapConfig extends android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig {
+    method @NonNull public android.net.eap.EapSessionConfig getEapConfig();
+  }
+
+  public static class IkeSessionParams.IkeAuthPskConfig extends android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig {
+    method @NonNull public byte[] getPsk();
+  }
+
+  public static interface IkeSessionParams.IkeConfigRequest {
+  }
+
   public final class IkeTrafficSelector {
     ctor public IkeTrafficSelector(int, int, @NonNull java.net.InetAddress, @NonNull java.net.InetAddress);
     field public final int endPort;
diff --git a/api/system-current.txt b/api/system-current.txt
index eb826d3..342858d 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -2,135 +2,25 @@
 package android.net.eap {
 
   public final class EapSessionConfig {
-    method @Nullable public android.net.eap.EapSessionConfig.EapAkaConfig getEapAkaConfig();
-    method @Nullable public android.net.eap.EapSessionConfig.EapAkaPrimeConfig getEapAkaPrimeConfig();
-    method @NonNull public byte[] getEapIdentity();
-    method @Nullable public android.net.eap.EapSessionConfig.EapMsChapV2Config getEapMsChapV2onfig();
-    method @Nullable public android.net.eap.EapSessionConfig.EapSimConfig getEapSimConfig();
-  }
-
-  public static final class EapSessionConfig.Builder {
-    ctor public EapSessionConfig.Builder();
-    method @NonNull public android.net.eap.EapSessionConfig build();
-    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapAkaConfig(int, int);
-    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapAkaPrimeConfig(int, int, @NonNull String, boolean);
-    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapIdentity(@NonNull byte[]);
-    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapMsChapV2Config(@NonNull String, @NonNull String);
-    method @NonNull public android.net.eap.EapSessionConfig.Builder setEapSimConfig(int, int);
-  }
-
-  public static class EapSessionConfig.EapAkaConfig extends android.net.eap.EapSessionConfig.EapUiccConfig {
-  }
-
-  public static class EapSessionConfig.EapAkaPrimeConfig extends android.net.eap.EapSessionConfig.EapAkaConfig {
-    method public boolean allowsMismatchedNetworkNames();
-    method @NonNull public String getNetworkName();
-  }
-
-  public abstract static class EapSessionConfig.EapMethodConfig {
-    method public int getMethodType();
-  }
-
-  public static class EapSessionConfig.EapMsChapV2Config extends android.net.eap.EapSessionConfig.EapMethodConfig {
-    method @NonNull public String getPassword();
-    method @NonNull public String getUsername();
-  }
-
-  public static class EapSessionConfig.EapSimConfig extends android.net.eap.EapSessionConfig.EapUiccConfig {
-  }
-
-  public abstract static class EapSessionConfig.EapUiccConfig extends android.net.eap.EapSessionConfig.EapMethodConfig {
-    method public int getAppType();
-    method public int getSubId();
+    method @Deprecated @Nullable public android.net.eap.EapSessionConfig.EapMsChapV2Config getEapMsChapV2onfig();
   }
 
 }
 
 package android.net.ipsec.ike {
 
-  public final class IkeSession implements java.lang.AutoCloseable {
-    ctor public IkeSession(@NonNull android.content.Context, @NonNull android.net.ipsec.ike.IkeSessionParams, @NonNull android.net.ipsec.ike.ChildSessionParams, @NonNull java.util.concurrent.Executor, @NonNull android.net.ipsec.ike.IkeSessionCallback, @NonNull android.net.ipsec.ike.ChildSessionCallback);
-    method public void close();
-    method public void closeChildSession(@NonNull android.net.ipsec.ike.ChildSessionCallback);
-    method public void kill();
-    method public void openChildSession(@NonNull android.net.ipsec.ike.ChildSessionParams, @NonNull android.net.ipsec.ike.ChildSessionCallback);
-  }
-
   public interface IkeSessionCallback {
     method public void onError(@NonNull android.net.ipsec.ike.exceptions.IkeProtocolException);
   }
 
   public final class IkeSessionParams {
-    method @NonNull public java.util.List<android.net.ipsec.ike.IkeSessionParams.IkeConfigRequest> getConfigurationRequests();
-    method @IntRange(from=0x14, to=0x708) public int getDpdDelaySeconds();
-    method @IntRange(from=0x12c, to=0x15180) public int getHardLifetimeSeconds();
     method @Nullable public android.net.ipsec.ike.ike3gpp.Ike3gppExtension getIke3gppExtension();
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig getLocalAuthConfig();
-    method @NonNull public android.net.ipsec.ike.IkeIdentification getLocalIdentification();
-    method @NonNull public android.net.Network getNetwork();
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig getRemoteAuthConfig();
-    method @NonNull public android.net.ipsec.ike.IkeIdentification getRemoteIdentification();
-    method public int[] getRetransmissionTimeoutsMillis();
-    method @NonNull public java.util.List<android.net.ipsec.ike.IkeSaProposal> getSaProposals();
-    method @NonNull public String getServerHostname();
-    method @IntRange(from=0x78, to=0x15180) public int getSoftLifetimeSeconds();
-    method public boolean hasIkeOption(int);
-    field public static final int IKE_OPTION_ACCEPT_ANY_REMOTE_ID = 0; // 0x0
-    field public static final int IKE_OPTION_EAP_ONLY_AUTH = 1; // 0x1
+    method @Deprecated @NonNull public android.net.Network getNetwork();
   }
 
   public static final class IkeSessionParams.Builder {
-    ctor public IkeSessionParams.Builder(@NonNull android.content.Context);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder addIkeOption(int);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder addPcscfServerRequest(@NonNull java.net.InetAddress);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder addPcscfServerRequest(int);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder addSaProposal(@NonNull android.net.ipsec.ike.IkeSaProposal);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams build();
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder removeIkeOption(int);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setAuthDigitalSignature(@Nullable java.security.cert.X509Certificate, @NonNull java.security.cert.X509Certificate, @NonNull java.security.PrivateKey);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setAuthDigitalSignature(@Nullable java.security.cert.X509Certificate, @NonNull java.security.cert.X509Certificate, @NonNull java.util.List<java.security.cert.X509Certificate>, @NonNull java.security.PrivateKey);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setAuthEap(@Nullable java.security.cert.X509Certificate, @NonNull android.net.eap.EapSessionConfig);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setAuthPsk(@NonNull byte[]);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setDpdDelaySeconds(@IntRange(from=0x14, to=0x708) int);
     method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setIke3gppExtension(@NonNull android.net.ipsec.ike.ike3gpp.Ike3gppExtension);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setLifetimeSeconds(@IntRange(from=0x12c, to=0x15180) int, @IntRange(from=0x78, to=0x15180) int);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setLocalIdentification(@NonNull android.net.ipsec.ike.IkeIdentification);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setNetwork(@NonNull android.net.Network);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setRemoteIdentification(@NonNull android.net.ipsec.ike.IkeIdentification);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setRetransmissionTimeoutsMillis(@NonNull int[]);
-    method @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setServerHostname(@NonNull String);
-  }
-
-  public static interface IkeSessionParams.ConfigRequestIpv4PcscfServer extends android.net.ipsec.ike.IkeSessionParams.IkeConfigRequest {
-    method @Nullable public java.net.Inet4Address getAddress();
-  }
-
-  public static interface IkeSessionParams.ConfigRequestIpv6PcscfServer extends android.net.ipsec.ike.IkeSessionParams.IkeConfigRequest {
-    method @Nullable public java.net.Inet6Address getAddress();
-  }
-
-  public abstract static class IkeSessionParams.IkeAuthConfig {
-  }
-
-  public static class IkeSessionParams.IkeAuthDigitalSignLocalConfig extends android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig {
-    method @NonNull public java.security.cert.X509Certificate getClientEndCertificate();
-    method @NonNull public java.util.List<java.security.cert.X509Certificate> getIntermediateCertificates();
-    method @NonNull public java.security.PrivateKey getPrivateKey();
-  }
-
-  public static class IkeSessionParams.IkeAuthDigitalSignRemoteConfig extends android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig {
-    method @Nullable public java.security.cert.X509Certificate getRemoteCaCert();
-  }
-
-  public static class IkeSessionParams.IkeAuthEapConfig extends android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig {
-    method @NonNull public android.net.eap.EapSessionConfig getEapConfig();
-  }
-
-  public static class IkeSessionParams.IkeAuthPskConfig extends android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig {
-    method @NonNull public byte[] getPsk();
-  }
-
-  public static interface IkeSessionParams.IkeConfigRequest {
+    method @Deprecated @NonNull public android.net.ipsec.ike.IkeSessionParams.Builder setNetwork(@NonNull android.net.Network);
   }
 
 }
diff --git a/src/java/android/net/eap/EapSessionConfig.java b/src/java/android/net/eap/EapSessionConfig.java
index ef30e22..538f2cc 100644
--- a/src/java/android/net/eap/EapSessionConfig.java
+++ b/src/java/android/net/eap/EapSessionConfig.java
@@ -47,10 +47,7 @@
  *
  * <p>The EAP authentication server decides which EAP method is used, so clients are encouraged to
  * provide configs for several EAP methods.
- *
- * @hide
  */
-@SystemApi
 public final class EapSessionConfig {
     private static final String EAP_ID_KEY = "eapIdentity";
     private static final String EAP_METHOD_CONFIGS_KEY = "eapConfigs";
@@ -175,11 +172,25 @@
      * @return the configuration for EAP MSCHAPV2, or null if it was not set
      */
     @Nullable
-    public EapMsChapV2Config getEapMsChapV2onfig() {
+    public EapMsChapV2Config getEapMsChapV2Config() {
         return (EapMsChapV2Config) mEapConfigs.get(EAP_TYPE_MSCHAP_V2);
     }
 
     /**
+     * Retrieves configuration for EAP MSCHAPV2
+     *
+     * @return the configuration for EAP MSCHAPV2, or null if it was not set
+     * @hide
+     * @deprecated Callers should use {@link #getEapMsChapV2Config}
+     */
+    @Deprecated
+    @SystemApi
+    @Nullable
+    public EapMsChapV2Config getEapMsChapV2onfig() {
+        return getEapMsChapV2Config();
+    }
+
+    /**
      * Retrieves configuration for EAP-TTLS
      *
      * @return the configuration for EAP-TTLS, or null if it was not set
diff --git a/src/java/android/net/ipsec/ike/IkeSession.java b/src/java/android/net/ipsec/ike/IkeSession.java
index 169cbff..2c4e404 100644
--- a/src/java/android/net/ipsec/ike/IkeSession.java
+++ b/src/java/android/net/ipsec/ike/IkeSession.java
@@ -17,7 +17,6 @@
 
 import android.annotation.NonNull;
 import android.annotation.SuppressLint;
-import android.annotation.SystemApi;
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.net.IpSecManager;
@@ -48,9 +47,7 @@
  *
  * @see <a href="https://tools.ietf.org/html/rfc7296">RFC 7296, Internet Key Exchange Protocol
  *     Version 2 (IKEv2)</a>
- * @hide
  */
-@SystemApi
 public final class IkeSession implements AutoCloseable {
     private final CloseGuard mCloseGuard = new CloseGuard();
     private final Context mContext;
diff --git a/src/java/android/net/ipsec/ike/IkeSessionParams.java b/src/java/android/net/ipsec/ike/IkeSessionParams.java
index 8b0f058..724aad5 100644
--- a/src/java/android/net/ipsec/ike/IkeSessionParams.java
+++ b/src/java/android/net/ipsec/ike/IkeSessionParams.java
@@ -66,10 +66,7 @@
  *
  * <p>Note that all negotiated configurations will be reused during rekey including SA Proposal and
  * lifetime.
- *
- * @hide
  */
-@SystemApi
 public final class IkeSessionParams {
     /** @hide */
     @Retention(RetentionPolicy.SOURCE)
@@ -382,16 +379,7 @@
         return mServerHostname;
     }
 
-    // TODO: b/151984042 Keep #getNetwork @SystemApi and make #getConfiguredNetwork public
-
-    /**
-     * Retrieves the configured {@link Network}, or null if not configured
-     *
-     * <p>This is the initially-configured Network (with MOBIKE, the caller may later specify a new
-     * Network and that update will not persist to here).
-     *
-     * @hide
-     */
+    /** Retrieves the configured {@link Network}, or null if was not set */
     @Nullable
     public Network getConfiguredNetwork() {
         return mCallerConfiguredNetwork;
@@ -405,14 +393,17 @@
      * informational because if MOBIKE is enabled, IKE Session may switch to a different default
      * Network.
      *
-     * <p>This is method will be deprecated. Callers should use {@link #getConfiguredNetwork}
+     * @hide
+     * @deprecated Callers should use {@link #getConfiguredNetwork}
      */
+    @Deprecated
+    @SystemApi
     @NonNull
     public Network getNetwork() {
         return mNetwork;
     }
 
-    /** Retrieves all ChildSaProposals configured */
+    /** Retrieves all IkeSaProposals configured */
     @NonNull
     public List<IkeSaProposal> getSaProposals() {
         return Arrays.asList(mSaProposals);
@@ -464,6 +455,8 @@
     }
 
     /** Retrieves the Dead Peer Detection(DPD) delay in seconds */
+    // Use "second" because smaller unit does not make sense to a DPD delay.
+    @SuppressLint("MethodNameUnits")
     @IntRange(from = IKE_DPD_DELAY_SEC_MIN, to = IKE_DPD_DELAY_SEC_MAX)
     public int getDpdDelaySeconds() {
         return mDpdDelaySec;
@@ -474,11 +467,17 @@
      *
      * <p>@see {@link Builder#setRetransmissionTimeoutsMillis(int[])}
      */
+    @NonNull
     public int[] getRetransmissionTimeoutsMillis() {
         return mRetransTimeoutMsList;
     }
 
-    /** Retrieves the configured Ike3gppExtension, or null if it was not set. */
+    /**
+     * Retrieves the configured Ike3gppExtension, or null if it was not set.
+     *
+     * @hide
+     */
+    @SystemApi
     @Nullable
     public Ike3gppExtension getIke3gppExtension() {
         return mIke3gppExtension;
@@ -1127,28 +1126,9 @@
          *
          * @param network the {@link Network} that IKE Session will use.
          * @return Builder this, to facilitate chaining.
-         * @hide
          */
         @NonNull
         public Builder setConfiguredNetwork(@NonNull Network network) {
-            return setNetwork(network);
-        }
-
-        // TODO: b/151984042 Keep #setNetwork @SystemApi and make #setConfiguredNetwork public
-
-        /**
-         * Sets the {@link Network} for the {@link IkeSessionParams} being built.
-         *
-         * <p>If no {@link Network} is provided, the default Network (as per {@link
-         * ConnectivityManager#getActiveNetwork()}) will be used.
-         *
-         * <p>This is method will be deprecated. Callers should use {@link #setConfiguredNetwork}
-         *
-         * @param network the {@link Network} that IKE Session will use.
-         * @return Builder this, to facilitate chaining.
-         */
-        @NonNull
-        public Builder setNetwork(@NonNull Network network) {
             if (network == null) {
                 throw new NullPointerException("Required argument not provided");
             }
@@ -1159,6 +1139,24 @@
         }
 
         /**
+         * Sets the {@link Network} for the {@link IkeSessionParams} being built.
+         *
+         * <p>If no {@link Network} is provided, the default Network (as per {@link
+         * ConnectivityManager#getActiveNetwork()}) will be used.
+         *
+         * @param network the {@link Network} that IKE Session will use.
+         * @return Builder this, to facilitate chaining.
+         * @hide
+         * @deprecated Callers should use {@link #setConfiguredNetwork}
+         */
+        @Deprecated
+        @SystemApi
+        @NonNull
+        public Builder setNetwork(@NonNull Network network) {
+            return setConfiguredNetwork(network);
+        }
+
+        /**
          * Sets local IKE identification for the {@link IkeSessionParams} being built.
          *
          * <p>It is not allowed to use KEY ID together with digital-signature-based authentication
@@ -1240,6 +1238,9 @@
          * @param sharedKey the shared key.
          * @return Builder this, to facilitate chaining.
          */
+        // #getLocalAuthConfig and #getRemoveAuthConfig are defined to retrieve
+        // authentication configurations
+        @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder setAuthPsk(@NonNull byte[] sharedKey) {
             if (sharedKey == null) {
@@ -1283,6 +1284,9 @@
          */
         // TODO(b/151667921): Consider also supporting configuring EAP method that is not accepted
         // by EAP-Only when {@link IKE_OPTION_EAP_ONLY_AUTH} is set
+        // MissingGetterMatchingBuilder: #getLocalAuthConfig and #getRemoveAuthConfig are defined to
+        // retrieve authentication configurations
+        @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder setAuthEap(
                 @Nullable X509Certificate serverCaCert, @NonNull EapSessionConfig eapConfig) {
@@ -1315,6 +1319,9 @@
          *     PrivateKey} MUST be an instance of {@link RSAKey}.
          * @return Builder this, to facilitate chaining.
          */
+        // #getLocalAuthConfig and #getRemoveAuthConfig are defined to retrieve
+        // authentication configurations
+        @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder setAuthDigitalSignature(
                 @Nullable X509Certificate serverCaCert,
@@ -1349,6 +1356,9 @@
          *     PrivateKey} MUST be an instance of {@link RSAKey}.
          * @return Builder this, to facilitate chaining.
          */
+        // #getLocalAuthConfig and #getRemoveAuthConfig are defined to retrieve
+        // authentication configurations
+        @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder setAuthDigitalSignature(
                 @Nullable X509Certificate serverCaCert,
@@ -1391,6 +1401,8 @@
          * @param address the requested P_CSCF address.
          * @return Builder this, to facilitate chaining.
          */
+        // #getConfigurationRequests is defined to retrieve PCSCF server requests
+        @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder addPcscfServerRequest(@NonNull InetAddress address) {
             if (address == null) {
@@ -1413,6 +1425,8 @@
          *     OsConstants.AF_INET6} are allowed.
          * @return Builder this, to facilitate chaining.
          */
+        // #getConfigurationRequests is defined to retrieve PCSCF server requests
+        @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder addPcscfServerRequest(int addressFamily) {
             if (addressFamily == AF_INET) {
@@ -1437,6 +1451,9 @@
          *     least 60 seconds (1 minute) shorter than the hard lifetime.
          * @return Builder this, to facilitate chaining.
          */
+        // #getHardLifetimeSeconds and #getSoftLifetimeSeconds are defined for callers to retrieve
+        // the lifetimes
+        @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder setLifetimeSeconds(
                 @IntRange(from = IKE_HARD_LIFETIME_SEC_MINIMUM, to = IKE_HARD_LIFETIME_SEC_MAXIMUM)
@@ -1519,7 +1536,9 @@
          *     access networks
          * @param ike3gppExtension the Ike3gppExtension to use for this IKE Session.
          * @return Builder this, to facilitate chaining.
+         * @hide
          */
+        @SystemApi
         @NonNull
         public Builder setIke3gppExtension(@NonNull Ike3gppExtension ike3gppExtension) {
             Objects.requireNonNull(ike3gppExtension, "ike3gppExtension must not be null");
@@ -1534,6 +1553,9 @@
          * @param ikeOption the option to be enabled.
          * @return Builder this, to facilitate chaining.
          */
+        // Use #hasIkeOption instead of @getIkeOptions because #hasIkeOption allows callers to check
+        // the presence of one IKE option more easily
+        @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder addIkeOption(@IkeOption int ikeOption) {
             validateIkeOptionOrThrow(ikeOption);
@@ -1547,6 +1569,9 @@
          * @param ikeOption the option to be disabled.
          * @return Builder this, to facilitate chaining.
          */
+        // Use #removeIkeOption instead of #clearIkeOption because "clear" sounds indicating
+        // clearing all enabled IKE options
+        @SuppressLint("BuilderSetStyle")
         @NonNull
         public Builder removeIkeOption(@IkeOption int ikeOption) {
             validateIkeOptionOrThrow(ikeOption);