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

Commit d3bda535 authored by Yan Yan's avatar Yan Yan Committed by Automerger Merge Worker
Browse files

Merge "Encode IkeSessionParams using getIkeOptions" into main am: ade57106 am: 06c8369c

parents b076162f 06c8369c
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -162,14 +162,23 @@ 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<>();

        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);
                }
            }
        }

        final int[] optionArray = enabledIkeOptions.stream().mapToInt(i -> i).toArray();
        result.putIntArray(IKE_OPTIONS_KEY, optionArray);