summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lorenzo Colitti <lorenzo@google.com> 2025-02-12 19:51:23 +0900
committer Lorenzo Colitti <lorenzo@google.com> 2025-03-14 16:43:26 +0900
commit26b2fd39cadeffbf5c1b064675958ace52e96baa (patch)
tree1b04ac716f1856d50a7542308a2019d25a8d420e
parentd5c28dd736aa52628af411cc56676ca4cb7fd0e2 (diff)
Add VpnManager.TYPE_VPN_OEM_* constants for OEM use.
Bug: 389829981 Test: new tests in NetworkAgentTest Change-Id: I343640c71bcf111675fa7018b94f9786e60973e6
-rw-r--r--core/api/module-lib-current.txt2
-rw-r--r--core/java/android/net/VpnManager.java26
-rw-r--r--core/java/android/net/flags.aconfig8
3 files changed, 34 insertions, 2 deletions
diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt
index 40069aa00106..788f9fb13018 100644
--- a/core/api/module-lib-current.txt
+++ b/core/api/module-lib-current.txt
@@ -294,6 +294,8 @@ package android.net {
field public static final int TYPE_VPN_LEGACY = 3; // 0x3
field public static final int TYPE_VPN_NONE = -1; // 0xffffffff
field public static final int TYPE_VPN_OEM = 4; // 0x4
+ field @FlaggedApi("android.net.platform.flags.vpn_type_oem_service_and_legacy") public static final int TYPE_VPN_OEM_LEGACY = 6; // 0x6
+ field @FlaggedApi("android.net.platform.flags.vpn_type_oem_service_and_legacy") public static final int TYPE_VPN_OEM_SERVICE = 5; // 0x5
field public static final int TYPE_VPN_PLATFORM = 2; // 0x2
field public static final int TYPE_VPN_SERVICE = 1; // 0x1
}
diff --git a/core/java/android/net/VpnManager.java b/core/java/android/net/VpnManager.java
index c50bc569de72..4ef293a90a80 100644
--- a/core/java/android/net/VpnManager.java
+++ b/core/java/android/net/VpnManager.java
@@ -20,6 +20,7 @@ import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
import static com.android.internal.util.Preconditions.checkNotNull;
+import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -32,6 +33,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
+import android.net.platform.flags.Flags;
import android.os.RemoteException;
import com.android.internal.net.LegacyVpnInfo;
@@ -85,13 +87,33 @@ public class VpnManager {
public static final int TYPE_VPN_LEGACY = 3;
/**
- * An VPN created by OEM code through other means than {@link VpnService} or {@link VpnManager}.
+ * A VPN created by OEM code through other means than {@link VpnService} or {@link VpnManager}.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public static final int TYPE_VPN_OEM = 4;
/**
+ * A VPN created by OEM code using {@link VpnService}, and which OEM code desires to
+ * differentiate from other VPN types. The core networking stack will treat this VPN type
+ * similarly to {@link #TYPE_VPN_SERVICE}.
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_VPN_TYPE_OEM_SERVICE_AND_LEGACY)
+ @SystemApi(client = MODULE_LIBRARIES)
+ public static final int TYPE_VPN_OEM_SERVICE = 5;
+
+ /**
+ * A VPN created by OEM code using the legacy VPN mechanisms, and which OEM code desires to
+ * differentiate from other VPN types. The core networking stack will treat this VPN type
+ * similarly to {@link #TYPE_VPN_LEGACY}.
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_VPN_TYPE_OEM_SERVICE_AND_LEGACY)
+ @SystemApi(client = MODULE_LIBRARIES)
+ public static final int TYPE_VPN_OEM_LEGACY = 6;
+
+ /**
* Channel for VPN notifications.
* @hide
*/
@@ -308,7 +330,7 @@ public class VpnManager {
/** @hide */
@IntDef(value = {TYPE_VPN_NONE, TYPE_VPN_SERVICE, TYPE_VPN_PLATFORM, TYPE_VPN_LEGACY,
- TYPE_VPN_OEM})
+ TYPE_VPN_OEM, TYPE_VPN_OEM_SERVICE, TYPE_VPN_OEM_LEGACY})
@Retention(RetentionPolicy.SOURCE)
public @interface VpnType {}
diff --git a/core/java/android/net/flags.aconfig b/core/java/android/net/flags.aconfig
index da2cccde126f..398808b561b8 100644
--- a/core/java/android/net/flags.aconfig
+++ b/core/java/android/net/flags.aconfig
@@ -45,3 +45,11 @@ flag {
description: "Flag for MDNS quality, reliability and performance improvement in 25Q2"
bug: "373270045"
}
+
+flag {
+ name: "vpn_type_oem_service_and_legacy"
+ namespace: "android_core_networking"
+ is_exported: false
+ description: "Flags the TYPE_VPN_OEM_SERVICE and TYPE_VPN_OEM_LEGACY VpnManager API constants"
+ bug: "389829981"
+}