From ab315c597d4231359f02584c91e0eda11e15d03c Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Mon, 14 Dec 2020 13:42:51 -0800 Subject: [PATCH] Keep Vehicle internal network always up Bug: 171801262 Test: Boot with and without overlay set and check ifconfig Change-Id: I1fd332caf3e09924abcfec9c2c137363be7873e4 --- core/api/system-current.txt | 1 + .../java/android/net/NetworkCapabilities.java | 32 +++++++++++++------ core/res/res/values/config.xml | 4 +++ core/res/res/values/symbols.xml | 1 + .../android/server/ConnectivityService.java | 30 ++++++++++++++++- 5 files changed, 57 insertions(+), 11 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index b4f1395532717..e7c1398016dcd 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -6235,6 +6235,7 @@ package android.net { field public static final int NET_CAPABILITY_OEM_PAID = 22; // 0x16 field public static final int NET_CAPABILITY_OEM_PRIVATE = 26; // 0x1a field public static final int NET_CAPABILITY_PARTIAL_CONNECTIVITY = 24; // 0x18 + field public static final int NET_CAPABILITY_VEHICLE_INTERNAL = 27; // 0x1b } public static final class NetworkCapabilities.Builder { diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java index 1a37fb9fb6903..286cdf9e38ffc 100644 --- a/core/java/android/net/NetworkCapabilities.java +++ b/core/java/android/net/NetworkCapabilities.java @@ -171,6 +171,7 @@ public final class NetworkCapabilities implements Parcelable { NET_CAPABILITY_PARTIAL_CONNECTIVITY, NET_CAPABILITY_TEMPORARILY_NOT_METERED, NET_CAPABILITY_OEM_PRIVATE, + NET_CAPABILITY_VEHICLE_INTERNAL, }) public @interface NetCapability { } @@ -357,8 +358,17 @@ public final class NetworkCapabilities implements Parcelable { @SystemApi public static final int NET_CAPABILITY_OEM_PRIVATE = 26; + /** + * Indicates this is an internal vehicle network, meant to communicate with other + * automotive systems. + * + * @hide + */ + @SystemApi + public static final int NET_CAPABILITY_VEHICLE_INTERNAL = 27; + private static final int MIN_NET_CAPABILITY = NET_CAPABILITY_MMS; - private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_OEM_PRIVATE; + private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_VEHICLE_INTERNAL; /** * Network capabilities that are expected to be mutable, i.e., can change while a particular @@ -401,15 +411,16 @@ public final class NetworkCapabilities implements Parcelable { */ @VisibleForTesting /* package */ static final long RESTRICTED_CAPABILITIES = - (1 << NET_CAPABILITY_CBS) | - (1 << NET_CAPABILITY_DUN) | - (1 << NET_CAPABILITY_EIMS) | - (1 << NET_CAPABILITY_FOTA) | - (1 << NET_CAPABILITY_IA) | - (1 << NET_CAPABILITY_IMS) | - (1 << NET_CAPABILITY_RCS) | - (1 << NET_CAPABILITY_XCAP) | - (1 << NET_CAPABILITY_MCX); + (1 << NET_CAPABILITY_CBS) + | (1 << NET_CAPABILITY_DUN) + | (1 << NET_CAPABILITY_EIMS) + | (1 << NET_CAPABILITY_FOTA) + | (1 << NET_CAPABILITY_IA) + | (1 << NET_CAPABILITY_IMS) + | (1 << NET_CAPABILITY_MCX) + | (1 << NET_CAPABILITY_RCS) + | (1 << NET_CAPABILITY_VEHICLE_INTERNAL) + | (1 << NET_CAPABILITY_XCAP); /** * Capabilities that force network to be restricted. @@ -1939,6 +1950,7 @@ public final class NetworkCapabilities implements Parcelable { case NET_CAPABILITY_PARTIAL_CONNECTIVITY: return "PARTIAL_CONNECTIVITY"; case NET_CAPABILITY_TEMPORARILY_NOT_METERED: return "TEMPORARILY_NOT_METERED"; case NET_CAPABILITY_OEM_PRIVATE: return "OEM_PRIVATE"; + case NET_CAPABILITY_VEHICLE_INTERNAL: return "NET_CAPABILITY_VEHICLE_INTERNAL"; default: return Integer.toString(capability); } } diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 42a658e500731..d30efa95edffe 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -455,6 +455,10 @@ --> + + false +