Enable wakeup marking for Cellular transport

Starting with Android U, the config_networkWakeupPacketMark and
config_networkWakeupPacketMask values will be used to mark packets that
woke up the AP on the cellular transport also.

Test: Manual, by inspecting the output of `iptables -L -t -n -v mangle`

Bug: 276498460
Change-Id: I4c7d2801532604d436bfda96c4c52a791995a9ed
This commit is contained in:
Suprabh Shukla
2023-04-25 23:15:43 -07:00
parent b21fe216cc
commit 7564228e3f

View File

@@ -7912,10 +7912,20 @@ public class ConnectivityService extends IConnectivityManager.Stub
return SdkLevel.isAtLeastU() ? (networkHandle + ":" + iface) : ("iface:" + iface); return SdkLevel.isAtLeastU() ? (networkHandle + ":" + iface) : ("iface:" + iface);
} }
private static boolean isWakeupMarkingSupported(NetworkCapabilities capabilities) {
if (capabilities.hasTransport(TRANSPORT_WIFI)) {
return true;
}
if (SdkLevel.isAtLeastU() && capabilities.hasTransport(TRANSPORT_CELLULAR)) {
return true;
}
return false;
}
private void wakeupModifyInterface(String iface, NetworkAgentInfo nai, boolean add) { private void wakeupModifyInterface(String iface, NetworkAgentInfo nai, boolean add) {
// Marks are only available on WiFi interfaces. Checking for // Marks are only available on WiFi interfaces. Checking for
// marks on unsupported interfaces is harmless. // marks on unsupported interfaces is harmless.
if (!nai.networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { if (!isWakeupMarkingSupported(nai.networkCapabilities)) {
return; return;
} }