diff options
author | Yan Yan <evitayan@google.com> | 2024-04-18 18:25:19 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-18 18:25:19 +0000 |
commit | ade571062f3bf5a886608d869b54a6d26b98d72e (patch) | |
tree | 342f2f61a8a0db24e5a419601297e142bfe73363 /core | |
parent | 7c60e2c375448b5e5b4da7de3874e52ecf7e770e (diff) | |
parent | 5457e16d32955afb97057dfc246b31ba684c10f1 (diff) | |
download | base-ade571062f3bf5a886608d869b54a6d26b98d72e.tar.gz |
Merge "Encode IkeSessionParams using getIkeOptions" into main
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java b/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java index d681a2c38f3d..d1531a119a0d 100644 --- a/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java +++ b/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java @@ -162,12 +162,21 @@ public final class IkeSessionParamsUtils { result.putInt(IP_VERSION_KEY, params.getIpVersion()); result.putInt(ENCAP_TYPE_KEY, params.getEncapType()); - // TODO: b/185941731 Make sure IkeSessionParamsUtils is automatically updated when a new - // IKE_OPTION is defined in IKE module and added in the IkeSessionParams final List<Integer> enabledIkeOptions = new ArrayList<>(); - for (int option : IKE_OPTIONS) { - if (isIkeOptionValid(option) && params.hasIkeOption(option)) { - enabledIkeOptions.add(option); + + try { + // TODO: b/328844044: Ideally this code should gate the behavior by checking the + // com.android.ipsec.flags.enabled_ike_options_api flag but that flag is not accessible + // right now. We should either update the code when the flag is accessible or remove the + // legacy behavior after VIC SDK finalization + enabledIkeOptions.addAll(params.getIkeOptions()); + } catch (Exception e) { + // getIkeOptions throws. It means the API is not available + enabledIkeOptions.clear(); + for (int option : IKE_OPTIONS) { + if (isIkeOptionValid(option) && params.hasIkeOption(option)) { + enabledIkeOptions.add(option); + } } } |