Loading services/core/java/com/android/server/ConnectivityService.java +30 −2 Original line number Original line Diff line number Diff line Loading @@ -209,6 +209,13 @@ public class ConnectivityService extends IConnectivityManager.Stub // See Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS // See Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS private final int mReleasePendingIntentDelayMs; private final int mReleasePendingIntentDelayMs; // Driver specific constants used to select packets received via // WiFi that caused the phone to exit sleep state. Currently there // is only one kernel implementation so we can get away with // constants. private static final int mWakeupPacketMark = 0x80000000; private static final int mWakeupPacketMask = 0x80000000; private MockableSystemProperties mSystemProperties; private MockableSystemProperties mSystemProperties; private Tethering mTethering; private Tethering mTethering; Loading Loading @@ -4352,7 +4359,7 @@ public class ConnectivityService extends IConnectivityManager.Stub networkAgent.clatd.fixupLinkProperties(oldLp); networkAgent.clatd.fixupLinkProperties(oldLp); } } updateInterfaces(newLp, oldLp, netId); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities); updateMtu(newLp, oldLp); updateMtu(newLp, oldLp); // TODO - figure out what to do for clat // TODO - figure out what to do for clat // for (LinkProperties lp : newLp.getStackedLinks()) { // for (LinkProperties lp : newLp.getStackedLinks()) { Loading Loading @@ -4390,7 +4397,26 @@ public class ConnectivityService extends IConnectivityManager.Stub } } } } private void updateInterfaces(LinkProperties newLp, LinkProperties oldLp, int netId) { private void wakeupAddInterface(String iface, NetworkCapabilities caps) throws RemoteException { // Marks are only available on WiFi interaces. Checking for // marks on unsupported interfaces is harmless. if (!caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { return; } mNetd.getNetdService().wakeupAddInterface( iface, "iface:" + iface, mWakeupPacketMark, mWakeupPacketMask); } private void wakeupDelInterface(String iface, NetworkCapabilities caps) throws RemoteException { if (!caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { return; } mNetd.getNetdService().wakeupDelInterface( iface, "iface:" + iface, mWakeupPacketMark, mWakeupPacketMask); } private void updateInterfaces(LinkProperties newLp, LinkProperties oldLp, int netId, NetworkCapabilities caps) { CompareResult<String> interfaceDiff = new CompareResult<String>(); CompareResult<String> interfaceDiff = new CompareResult<String>(); if (oldLp != null) { if (oldLp != null) { interfaceDiff = oldLp.compareAllInterfaceNames(newLp); interfaceDiff = oldLp.compareAllInterfaceNames(newLp); Loading @@ -4401,6 +4427,7 @@ public class ConnectivityService extends IConnectivityManager.Stub try { try { if (DBG) log("Adding iface " + iface + " to network " + netId); if (DBG) log("Adding iface " + iface + " to network " + netId); mNetd.addInterfaceToNetwork(iface, netId); mNetd.addInterfaceToNetwork(iface, netId); wakeupAddInterface(iface, caps); } catch (Exception e) { } catch (Exception e) { loge("Exception adding interface: " + e); loge("Exception adding interface: " + e); } } Loading @@ -4409,6 +4436,7 @@ public class ConnectivityService extends IConnectivityManager.Stub try { try { if (DBG) log("Removing iface " + iface + " from network " + netId); if (DBG) log("Removing iface " + iface + " from network " + netId); mNetd.removeInterfaceFromNetwork(iface, netId); mNetd.removeInterfaceFromNetwork(iface, netId); wakeupDelInterface(iface, caps); } catch (Exception e) { } catch (Exception e) { loge("Exception removing interface: " + e); loge("Exception removing interface: " + e); } } Loading services/core/java/com/android/server/connectivity/NetdEventListenerService.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -135,6 +135,10 @@ public class NetdEventListenerService extends INetdEventListener.Stub { } } } } @Override public synchronized void onWakeupEvent(String prefix, int uid, int gid, long timestampNs) { } public synchronized void flushStatistics(List<IpConnectivityEvent> events) { public synchronized void flushStatistics(List<IpConnectivityEvent> events) { flushProtos(events, mConnectEvents, IpConnectivityEventBuilder::toProto); flushProtos(events, mConnectEvents, IpConnectivityEventBuilder::toProto); flushProtos(events, mDnsEvents, IpConnectivityEventBuilder::toProto); flushProtos(events, mDnsEvents, IpConnectivityEventBuilder::toProto); Loading Loading
services/core/java/com/android/server/ConnectivityService.java +30 −2 Original line number Original line Diff line number Diff line Loading @@ -209,6 +209,13 @@ public class ConnectivityService extends IConnectivityManager.Stub // See Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS // See Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS private final int mReleasePendingIntentDelayMs; private final int mReleasePendingIntentDelayMs; // Driver specific constants used to select packets received via // WiFi that caused the phone to exit sleep state. Currently there // is only one kernel implementation so we can get away with // constants. private static final int mWakeupPacketMark = 0x80000000; private static final int mWakeupPacketMask = 0x80000000; private MockableSystemProperties mSystemProperties; private MockableSystemProperties mSystemProperties; private Tethering mTethering; private Tethering mTethering; Loading Loading @@ -4352,7 +4359,7 @@ public class ConnectivityService extends IConnectivityManager.Stub networkAgent.clatd.fixupLinkProperties(oldLp); networkAgent.clatd.fixupLinkProperties(oldLp); } } updateInterfaces(newLp, oldLp, netId); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities); updateMtu(newLp, oldLp); updateMtu(newLp, oldLp); // TODO - figure out what to do for clat // TODO - figure out what to do for clat // for (LinkProperties lp : newLp.getStackedLinks()) { // for (LinkProperties lp : newLp.getStackedLinks()) { Loading Loading @@ -4390,7 +4397,26 @@ public class ConnectivityService extends IConnectivityManager.Stub } } } } private void updateInterfaces(LinkProperties newLp, LinkProperties oldLp, int netId) { private void wakeupAddInterface(String iface, NetworkCapabilities caps) throws RemoteException { // Marks are only available on WiFi interaces. Checking for // marks on unsupported interfaces is harmless. if (!caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { return; } mNetd.getNetdService().wakeupAddInterface( iface, "iface:" + iface, mWakeupPacketMark, mWakeupPacketMask); } private void wakeupDelInterface(String iface, NetworkCapabilities caps) throws RemoteException { if (!caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { return; } mNetd.getNetdService().wakeupDelInterface( iface, "iface:" + iface, mWakeupPacketMark, mWakeupPacketMask); } private void updateInterfaces(LinkProperties newLp, LinkProperties oldLp, int netId, NetworkCapabilities caps) { CompareResult<String> interfaceDiff = new CompareResult<String>(); CompareResult<String> interfaceDiff = new CompareResult<String>(); if (oldLp != null) { if (oldLp != null) { interfaceDiff = oldLp.compareAllInterfaceNames(newLp); interfaceDiff = oldLp.compareAllInterfaceNames(newLp); Loading @@ -4401,6 +4427,7 @@ public class ConnectivityService extends IConnectivityManager.Stub try { try { if (DBG) log("Adding iface " + iface + " to network " + netId); if (DBG) log("Adding iface " + iface + " to network " + netId); mNetd.addInterfaceToNetwork(iface, netId); mNetd.addInterfaceToNetwork(iface, netId); wakeupAddInterface(iface, caps); } catch (Exception e) { } catch (Exception e) { loge("Exception adding interface: " + e); loge("Exception adding interface: " + e); } } Loading @@ -4409,6 +4436,7 @@ public class ConnectivityService extends IConnectivityManager.Stub try { try { if (DBG) log("Removing iface " + iface + " from network " + netId); if (DBG) log("Removing iface " + iface + " from network " + netId); mNetd.removeInterfaceFromNetwork(iface, netId); mNetd.removeInterfaceFromNetwork(iface, netId); wakeupDelInterface(iface, caps); } catch (Exception e) { } catch (Exception e) { loge("Exception removing interface: " + e); loge("Exception removing interface: " + e); } } Loading
services/core/java/com/android/server/connectivity/NetdEventListenerService.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -135,6 +135,10 @@ public class NetdEventListenerService extends INetdEventListener.Stub { } } } } @Override public synchronized void onWakeupEvent(String prefix, int uid, int gid, long timestampNs) { } public synchronized void flushStatistics(List<IpConnectivityEvent> events) { public synchronized void flushStatistics(List<IpConnectivityEvent> events) { flushProtos(events, mConnectEvents, IpConnectivityEventBuilder::toProto); flushProtos(events, mConnectEvents, IpConnectivityEventBuilder::toProto); flushProtos(events, mDnsEvents, IpConnectivityEventBuilder::toProto); flushProtos(events, mDnsEvents, IpConnectivityEventBuilder::toProto); Loading