From 3804613f603d8f305cc5b42db5c56b09c1ac26b1 Mon Sep 17 00:00:00 2001 From: Yan Yan Date: Fri, 12 Mar 2021 12:29:01 -0800 Subject: [PATCH] Automatically add FEATURE_IPSEC_TUNNEL_MIGRATION for U/U+ devices. This change automatically enables the IPSEC_TUNNEL_MIGRATION feature if the VSR API level is greater than T This is for OEM convenience to ensure that they do not have to add the feature for each device that they ship. Bug: 169169973 Test: Removed feature from device, CTS tested on sunfish that the feature does not exist Change-Id: I4ddaa8803be6e9738a2bd0af6793720571b67ff2 --- core/java/com/android/server/SystemConfig.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java index 00b01051adae9..088c0016c0dab 100644 --- a/core/java/com/android/server/SystemConfig.java +++ b/core/java/com/android/server/SystemConfig.java @@ -1521,6 +1521,8 @@ public class SystemConfig { addFeature(PackageManager.FEATURE_IPSEC_TUNNELS, 0); } + enableIpSecTunnelMigrationOnVsrUAndAbove(); + if (isErofsSupported()) { if (isKernelVersionAtLeast(5, 10)) { addFeature(PackageManager.FEATURE_EROFS, 0); @@ -1534,6 +1536,18 @@ public class SystemConfig { } } + // This method only enables a new Android feature added in U and will not have impact on app + // compatibility + @SuppressWarnings("AndroidFrameworkCompatChange") + private void enableIpSecTunnelMigrationOnVsrUAndAbove() { + final int vsrApi = + SystemProperties.getInt( + "ro.vendor.api_level", Build.VERSION.DEVICE_INITIAL_SDK_INT); + if (vsrApi > Build.VERSION_CODES.TIRAMISU) { + addFeature(PackageManager.FEATURE_IPSEC_TUNNEL_MIGRATION, 0); + } + } + private void addFeature(String name, int version) { FeatureInfo fi = mAvailableFeatures.get(name); if (fi == null) {