Allow callers to use REKEY_MOBILITY with its integer value

This commit removes the restriction that prevents external
callers from accessing IKE_OPTION_REKEY_MOBILITY by using
its integer value.

Bug: 230841280
Test: atest FrameworksIkeTests, CtsIkeTestCases
Test: verified against Strongswan
Original change: https://android-review.googlesource.com/c/platform/packages/modules/IPsec/+/2093123
Merged-In: I7300652602371049f92f4393f7d865ba5a74d9a3

Change-Id: I7300652602371049f92f4393f7d865ba5a74d9a3
diff --git a/src/java/android/net/ipsec/ike/IkeSessionParams.java b/src/java/android/net/ipsec/ike/IkeSessionParams.java
index 04f3462..d8131b8 100644
--- a/src/java/android/net/ipsec/ike/IkeSessionParams.java
+++ b/src/java/android/net/ipsec/ike/IkeSessionParams.java
@@ -1853,10 +1853,6 @@
         @SuppressLint("MissingGetterMatchingBuilder")
         @NonNull
         public Builder addIkeOption(@IkeOption int ikeOption) {
-            if (ikeOption == IKE_OPTION_REKEY_MOBILITY) {
-                throw new IllegalArgumentException("Invalid IKE Option: " + ikeOption);
-            }
-
             return addIkeOptionInternal(ikeOption);
         }
 
@@ -1864,9 +1860,9 @@
         @NonNull
         public Builder addIkeOptionInternal(@IkeOption int ikeOption) {
             validateIkeOptionOrThrow(ikeOption);
-            if (ikeOption == IKE_OPTION_MOBIKE) {
+            if (ikeOption == IKE_OPTION_MOBIKE || ikeOption == IKE_OPTION_REKEY_MOBILITY) {
                 if (!SdkLevel.isAtLeastS()) {
-                    throw new UnsupportedOperationException("MOBIKE only supported for S/S+");
+                    throw new UnsupportedOperationException("Mobility only supported for S/S+");
                 } else if (!SdkLevel.isAtLeastT()) {
                     // Automatically enable IKE_OPTION_REKEY_MOBILITY if S <= SDK < T for
                     // compatibility