Add shims for Ikev2VpnProfile and its builder
Shims are necessary to test the new "requiresValidation"
API for VpnManager.
Test: m ; usage of these shims in the next patch.
Change-Id: Ic57b14f85679ba96962327035bae049034c8aa72
diff --git a/apishim/29/com/android/networkstack/apishim/api29/Ikev2VpnProfileBuilderShimImpl.java b/apishim/29/com/android/networkstack/apishim/api29/Ikev2VpnProfileBuilderShimImpl.java
new file mode 100644
index 0000000..754933a
--- /dev/null
+++ b/apishim/29/com/android/networkstack/apishim/api29/Ikev2VpnProfileBuilderShimImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.api29;
+
+import com.android.networkstack.apishim.common.Ikev2VpnProfileBuilderShim;
+import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
+
+/**
+ * Implementation of Ikev2VpnProfileBuilderShim for API 29.
+ *
+ * @param <T> type of builder, typically Ikev2VpnProfile.Builder. This is necessary because at
+ * compile time, shims for older releases will not have access to this class as it
+ * debuted in SDK30. So the user of the shim has to pass it in.
+ */
+// NOTE : the trick with the formal parameter only works because when this shim was introduced,
+// the stable API already contained the class that the caller needs to pass in; this won't
+// work for a class added in the latest API level.
+public class Ikev2VpnProfileBuilderShimImpl<T> implements Ikev2VpnProfileBuilderShim<T> {
+ /**
+ * @see Ikev2VpnProfile.Builder#setRequiresInternetValidation(boolean)
+ */
+ @Override
+ public T setRequiresInternetValidation(T builder,
+ boolean requiresInternetValidation) throws UnsupportedApiLevelException {
+ throw new UnsupportedApiLevelException("Only supported from API level 33.");
+ }
+}
diff --git a/apishim/29/com/android/networkstack/apishim/api29/Ikev2VpnProfileShimImpl.java b/apishim/29/com/android/networkstack/apishim/api29/Ikev2VpnProfileShimImpl.java
new file mode 100644
index 0000000..d9ad4fe
--- /dev/null
+++ b/apishim/29/com/android/networkstack/apishim/api29/Ikev2VpnProfileShimImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.api29;
+
+import com.android.networkstack.apishim.common.Ikev2VpnProfileShim;
+import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
+
+/**
+ * Implementation of Ikev2VpnProfileShim for API 29.
+ * @param <T> type of profile, typically Ikev2VpnProfile
+ */
+public class Ikev2VpnProfileShimImpl<T> implements Ikev2VpnProfileShim<T> {
+ /**
+ * @see Ikev2VpnProfile#getRequiresInternetValidation(boolean)
+ */
+ @Override
+ public boolean getRequiresInternetValidation(T profile)
+ throws UnsupportedApiLevelException {
+ throw new UnsupportedApiLevelException("Only supported from API level 33.");
+ }
+}
diff --git a/apishim/29/com/android/networkstack/apishim/api29/NetworkAgentConfigShimImpl.java b/apishim/29/com/android/networkstack/apishim/api29/NetworkAgentConfigShimImpl.java
new file mode 100644
index 0000000..3c38b87
--- /dev/null
+++ b/apishim/29/com/android/networkstack/apishim/api29/NetworkAgentConfigShimImpl.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.api29;
+
+import com.android.networkstack.apishim.common.NetworkAgentConfigShim;
+
+/**
+ * Implementation of NetworkAgentConfigShim for API 29.
+ */
+public class NetworkAgentConfigShimImpl implements NetworkAgentConfigShim {
+ @Override
+ public boolean getVpnRequiresValidation() {
+ return false;
+ }
+}
diff --git a/apishim/30/com/android/networkstack/apishim/api30/Ikev2VpnProfileBuilderShimImpl.java b/apishim/30/com/android/networkstack/apishim/api30/Ikev2VpnProfileBuilderShimImpl.java
new file mode 100644
index 0000000..a8310ce
--- /dev/null
+++ b/apishim/30/com/android/networkstack/apishim/api30/Ikev2VpnProfileBuilderShimImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.api30;
+
+import android.net.Ikev2VpnProfile;
+
+import com.android.networkstack.apishim.common.Ikev2VpnProfileBuilderShim;
+
+/**
+ * Implementation of Ikev2VpnProfileBuilderShim for API 30.
+ */
+// TODO : when API29 is no longer supported, remove the type argument
+public class Ikev2VpnProfileBuilderShimImpl
+ extends com.android.networkstack.apishim.api29.Ikev2VpnProfileBuilderShimImpl<
+ Ikev2VpnProfile.Builder
+ > {
+ /**
+ * Returns a new instance of this shim impl.
+ */
+ public static Ikev2VpnProfileBuilderShim<Ikev2VpnProfile.Builder> newInstance() {
+ return new Ikev2VpnProfileBuilderShimImpl();
+ }
+}
diff --git a/apishim/30/com/android/networkstack/apishim/api30/Ikev2VpnProfileShimImpl.java b/apishim/30/com/android/networkstack/apishim/api30/Ikev2VpnProfileShimImpl.java
new file mode 100644
index 0000000..cd7938f
--- /dev/null
+++ b/apishim/30/com/android/networkstack/apishim/api30/Ikev2VpnProfileShimImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.api30;
+
+import android.net.Ikev2VpnProfile;
+
+import com.android.networkstack.apishim.common.Ikev2VpnProfileShim;
+
+/**
+ * Implementation of Ikev2VpnProfileShim for API 30.
+ */
+// TODO : when API29 is no longer supported, remove the type argument
+public class Ikev2VpnProfileShimImpl extends
+ com.android.networkstack.apishim.api29.Ikev2VpnProfileShimImpl<Ikev2VpnProfile> {
+ /**
+ * Returns a new instance of this shim impl.
+ */
+ public static Ikev2VpnProfileShim<Ikev2VpnProfile> newInstance() {
+ return new Ikev2VpnProfileShimImpl();
+ }
+}
diff --git a/apishim/31/com/android/networkstack/apishim/api31/Ikev2VpnProfileBuilderShimImpl.java b/apishim/31/com/android/networkstack/apishim/api31/Ikev2VpnProfileBuilderShimImpl.java
new file mode 100644
index 0000000..d4f25d6
--- /dev/null
+++ b/apishim/31/com/android/networkstack/apishim/api31/Ikev2VpnProfileBuilderShimImpl.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.api31;
+
+/**
+ * Implementation of Ikev2VpnProfileBuilderShim for API 31.
+ */
+public class Ikev2VpnProfileBuilderShimImpl
+ extends com.android.networkstack.apishim.api30.Ikev2VpnProfileBuilderShimImpl {
+}
diff --git a/apishim/31/com/android/networkstack/apishim/api31/Ikev2VpnProfileShimImpl.java b/apishim/31/com/android/networkstack/apishim/api31/Ikev2VpnProfileShimImpl.java
new file mode 100644
index 0000000..e2d8b59
--- /dev/null
+++ b/apishim/31/com/android/networkstack/apishim/api31/Ikev2VpnProfileShimImpl.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.api31;
+
+/**
+ * Implementation of Ikev2VpnProfileShim for API 31.
+ */
+public class Ikev2VpnProfileShimImpl extends
+ com.android.networkstack.apishim.api30.Ikev2VpnProfileShimImpl {
+}
diff --git a/apishim/31/com/android/networkstack/apishim/api31/NetworkAgentConfigShimImpl.java b/apishim/31/com/android/networkstack/apishim/api31/NetworkAgentConfigShimImpl.java
new file mode 100644
index 0000000..908cc1d
--- /dev/null
+++ b/apishim/31/com/android/networkstack/apishim/api31/NetworkAgentConfigShimImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.api31;
+
+import android.net.NetworkAgentConfig;
+
+import androidx.annotation.Nullable;
+
+import com.android.networkstack.apishim.common.NetworkAgentConfigShim;
+
+/**
+ * Implementation of NetworkAgentConfigShim for API 31.
+ *
+ * Compared with API29, NetworkAgentConfig is now API, though the shim currently doesn't
+ * need to implement any of its methods yet.
+ */
+public class NetworkAgentConfigShimImpl
+ extends com.android.networkstack.apishim.api29.NetworkAgentConfigShimImpl {
+ // This can be null when running on a device with an old Connectivity module.
+ @Nullable
+ protected final NetworkAgentConfig mNetworkAgentConfig;
+
+ protected NetworkAgentConfigShimImpl(@Nullable final NetworkAgentConfig config) {
+ mNetworkAgentConfig = config;
+ }
+
+ /**
+ * Returns a new instance of this shim impl.
+ */
+ public static NetworkAgentConfigShim newInstance(@Nullable final NetworkAgentConfig config) {
+ return new NetworkAgentConfigShimImpl(config);
+ }
+}
diff --git a/apishim/33/com/android/networkstack/apishim/Ikev2VpnProfileBuilderShimImpl.java b/apishim/33/com/android/networkstack/apishim/Ikev2VpnProfileBuilderShimImpl.java
new file mode 100644
index 0000000..d3315a2
--- /dev/null
+++ b/apishim/33/com/android/networkstack/apishim/Ikev2VpnProfileBuilderShimImpl.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim;
+
+import android.net.Ikev2VpnProfile;
+import android.os.Build;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
+
+import com.android.modules.utils.build.SdkLevel;
+import com.android.networkstack.apishim.common.Ikev2VpnProfileBuilderShim;
+
+/**
+ * A shim for Ikev2VpnProfile.Builder
+ */
+@RequiresApi(Build.VERSION_CODES.TIRAMISU)
+public class Ikev2VpnProfileBuilderShimImpl
+ extends com.android.networkstack.apishim.api31.Ikev2VpnProfileBuilderShimImpl {
+ /**
+ * Returns a new instance of this shim impl.
+ */
+ @RequiresApi(Build.VERSION_CODES.R)
+ public static Ikev2VpnProfileBuilderShim<Ikev2VpnProfile.Builder> newInstance() {
+ if (SdkLevel.isAtLeastT()) {
+ return new Ikev2VpnProfileBuilderShimImpl();
+ } else {
+ return com.android.networkstack.apishim.api31.Ikev2VpnProfileBuilderShimImpl
+ .newInstance();
+ }
+ }
+
+ /**
+ * @see Ikev2VpnProfile.Builder#setRequiresInternetValidation(boolean)
+ */
+ @Override
+ public Ikev2VpnProfile.Builder setRequiresInternetValidation(
+ @NonNull final Ikev2VpnProfile.Builder builder, boolean requiresInternetValidation) {
+ builder.setRequiresInternetValidation(requiresInternetValidation);
+ return builder;
+ }
+}
diff --git a/apishim/33/com/android/networkstack/apishim/Ikev2VpnProfileShimImpl.java b/apishim/33/com/android/networkstack/apishim/Ikev2VpnProfileShimImpl.java
new file mode 100644
index 0000000..6267eee
--- /dev/null
+++ b/apishim/33/com/android/networkstack/apishim/Ikev2VpnProfileShimImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim;
+
+import android.net.Ikev2VpnProfile;
+import android.os.Build;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
+
+import com.android.modules.utils.build.SdkLevel;
+import com.android.networkstack.apishim.common.Ikev2VpnProfileShim;
+
+/**
+ * A shim for Ikev2VpnProfile
+ */
+@RequiresApi(Build.VERSION_CODES.TIRAMISU)
+public class Ikev2VpnProfileShimImpl
+ extends com.android.networkstack.apishim.api31.Ikev2VpnProfileShimImpl {
+ /**
+ * Returns a new instance of this shim impl.
+ */
+ @RequiresApi(Build.VERSION_CODES.R)
+ public static Ikev2VpnProfileShim<Ikev2VpnProfile> newInstance() {
+ if (SdkLevel.isAtLeastT()) {
+ return new Ikev2VpnProfileShimImpl();
+ } else {
+ return com.android.networkstack.apishim.api31.Ikev2VpnProfileShimImpl.newInstance();
+ }
+ }
+
+ /**
+ * @see Ikev2VpnProfile#getRequiresInternetValidation()
+ */
+ @Override
+ public boolean getRequiresInternetValidation(@NonNull final Ikev2VpnProfile profile) {
+ return profile.getRequiresInternetValidation();
+ }
+}
diff --git a/apishim/33/com/android/networkstack/apishim/NetworkAgentConfigShimImpl.java b/apishim/33/com/android/networkstack/apishim/NetworkAgentConfigShimImpl.java
new file mode 100644
index 0000000..5e78fda
--- /dev/null
+++ b/apishim/33/com/android/networkstack/apishim/NetworkAgentConfigShimImpl.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim;
+
+import static com.android.modules.utils.build.SdkLevel.isAtLeastT;
+
+import android.net.NetworkAgentConfig;
+
+import androidx.annotation.Nullable;
+
+import com.android.networkstack.apishim.common.NetworkAgentConfigShim;
+
+/**
+ * A shim for NetworkAgentConfig
+ */
+public class NetworkAgentConfigShimImpl
+ extends com.android.networkstack.apishim.api31.NetworkAgentConfigShimImpl {
+ protected NetworkAgentConfigShimImpl(@Nullable final NetworkAgentConfig config) {
+ super(config);
+ }
+
+ /**
+ * Returns a new instance of this shim impl.
+ */
+ public static NetworkAgentConfigShim newInstance(@Nullable final NetworkAgentConfig config) {
+ if (!isAtLeastT()) {
+ return com.android.networkstack.apishim.api31.NetworkAgentConfigShimImpl
+ .newInstance(config);
+ } else {
+ return new NetworkAgentConfigShimImpl(config);
+ }
+ }
+
+ @Override
+ public boolean getVpnRequiresValidation() {
+ if (null == mNetworkAgentConfig) {
+ return false;
+ } else {
+ return mNetworkAgentConfig.getVpnRequiresValidation();
+ }
+ }
+
+ @Override
+ public String toString() {
+ if (null == mNetworkAgentConfig) {
+ return "NetworkAgentConfigShimImpl[null]";
+ } else {
+ return mNetworkAgentConfig.toString();
+ }
+ }
+}
diff --git a/apishim/common/com/android/networkstack/apishim/common/Ikev2VpnProfileBuilderShim.java b/apishim/common/com/android/networkstack/apishim/common/Ikev2VpnProfileBuilderShim.java
new file mode 100644
index 0000000..b2483e3
--- /dev/null
+++ b/apishim/common/com/android/networkstack/apishim/common/Ikev2VpnProfileBuilderShim.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.common;
+
+/**
+ * A shim for Ikev2VpnProfile.Builder.
+ *
+ * T should extend Ikev2VpnProfile.Builder, but this can't be written here as that class is not
+ * available in API29.
+ * @param <T> type of builder, typically Ikev2VpnProfile.Builder
+ */
+// TODO : when API29 is no longer supported, remove the type argument
+public interface Ikev2VpnProfileBuilderShim<T> {
+ /**
+ * @see Ikev2VpnProfile.Builder#setRequiresInternetValidation(boolean)
+ */
+ T setRequiresInternetValidation(T builder, boolean requiresInternetValidation)
+ throws UnsupportedApiLevelException;
+}
diff --git a/apishim/common/com/android/networkstack/apishim/common/Ikev2VpnProfileShim.java b/apishim/common/com/android/networkstack/apishim/common/Ikev2VpnProfileShim.java
new file mode 100644
index 0000000..1c42330
--- /dev/null
+++ b/apishim/common/com/android/networkstack/apishim/common/Ikev2VpnProfileShim.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.common;
+
+/**
+ * A shim for Ikev2VpnProfile.
+ *
+ * T should extend Ikev2VpnProfile, but this can't be written here as that class is not
+ * available in API29.
+ * @param <T> type of profile, typically Ikev2VpnProfile
+ */
+// TODO : when API29 is no longer supported, remove the type argument
+public interface Ikev2VpnProfileShim<T> {
+ /**
+ * @see Ikev2VpnProfile#getRequiresInternetValidation()
+ */
+ boolean getRequiresInternetValidation(T profile) throws UnsupportedApiLevelException;
+}
diff --git a/apishim/common/com/android/networkstack/apishim/common/NetworkAgentConfigShim.java b/apishim/common/com/android/networkstack/apishim/common/NetworkAgentConfigShim.java
new file mode 100644
index 0000000..6274aa4
--- /dev/null
+++ b/apishim/common/com/android/networkstack/apishim/common/NetworkAgentConfigShim.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim.common;
+
+import android.net.NetworkAgentConfig;
+
+/**
+ * A shim for NetworkAgentConfig
+ */
+public interface NetworkAgentConfigShim {
+ /**
+ * @see NetworkAgentConfig#getVpnRequiresValidation()
+ */
+ boolean getVpnRequiresValidation();
+}
diff --git a/common/networkstackclient/src/android/net/NetworkMonitorManager.java b/common/networkstackclient/src/android/net/NetworkMonitorManager.java
index 0f66981..2cfec17 100644
--- a/common/networkstackclient/src/android/net/NetworkMonitorManager.java
+++ b/common/networkstackclient/src/android/net/NetworkMonitorManager.java
@@ -18,6 +18,7 @@
import android.annotation.Hide;
import android.annotation.NonNull;
+import android.net.networkstack.aidl.NetworkMonitorParameters;
import android.os.Binder;
import android.os.RemoteException;
import android.util.Log;
@@ -147,10 +148,10 @@
}
}
- public boolean notifyNetworkConnected(LinkProperties lp, NetworkCapabilities nc) {
+ public boolean notifyNetworkConnected(NetworkMonitorParameters params) {
final long token = Binder.clearCallingIdentity();
try {
- mNetworkMonitor.notifyNetworkConnected(lp, nc);
+ mNetworkMonitor.notifyNetworkConnectedParcel(params);
return true;
} catch (RemoteException e) {
log("Error in notifyNetworkConnected", e);