Loading services/core/java/com/android/server/ConnectivityService.java +15 −50 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ import android.net.NetworkFactory; import android.net.NetworkInfo; import android.net.NetworkInfo.DetailedState; import android.net.NetworkMisc; import android.net.NetworkMonitorManager; import android.net.NetworkPolicyManager; import android.net.NetworkQuotaInfo; import android.net.NetworkRequest; Loading Loading @@ -1784,8 +1785,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // callback from each caller type. Need to re-factor NetdEventListenerService to allow // multiple NetworkMonitor registrants. if (nai != null && nai.satisfies(mDefaultRequest)) { Binder.withCleanCallingIdentity(() -> nai.networkMonitor().notifyDnsResponse(returnCode)); nai.networkMonitor().notifyDnsResponse(returnCode); } } Loading Loading @@ -2852,11 +2852,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // Notify the NetworkAgentInfo/NetworkMonitor in case NetworkMonitor needs to cancel or // schedule DNS resolutions. If a DNS resolution is required the // result will be sent back to us. try { nai.networkMonitor().notifyPrivateDnsChanged(cfg.toParcel()); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } // With Private DNS bypass support, we can proceed to update the // Private DNS config immediately, even if we're in strict mode Loading Loading @@ -3022,11 +3018,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // Disable wakeup packet monitoring for each interface. wakeupModifyInterface(iface, nai.networkCapabilities, false); } try { nai.networkMonitor().notifyNetworkDisconnected(); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } mNetworkAgentInfos.remove(nai.messenger); nai.clatd.update(); synchronized (mNetworkForNetId) { Loading Loading @@ -3439,11 +3431,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // // TODO: NetworkMonitor does not refer to the "never ask again" bit. The bit is stored // per network. Therefore, NetworkMonitor may still do https probe. try { nai.networkMonitor().setAcceptPartialConnectivity(); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } } } Loading Loading @@ -3475,11 +3463,7 @@ public class ConnectivityService extends IConnectivityManager.Stub NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(network); if (nai == null) return; if (!nai.networkCapabilities.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)) return; try { nai.networkMonitor().launchCaptivePortalApp(); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } }); } Loading Loading @@ -3514,7 +3498,7 @@ public class ConnectivityService extends IConnectivityManager.Stub } @Override public void appResponse(final int response) throws RemoteException { public void appResponse(final int response) { if (response == CaptivePortal.APP_RETURN_WANTED_AS_IS) { enforceSettingsPermission(); } Loading @@ -3524,16 +3508,9 @@ public class ConnectivityService extends IConnectivityManager.Stub if (nai == null) return; // nai.networkMonitor() is thread-safe final INetworkMonitor nm = nai.networkMonitor(); final NetworkMonitorManager nm = nai.networkMonitor(); if (nm == null) return; final long token = Binder.clearCallingIdentity(); try { nm.notifyCaptivePortalAppFinished(response); } finally { // Not using Binder.withCleanCallingIdentity() to keep the checked RemoteException Binder.restoreCallingIdentity(token); } } @Override Loading Loading @@ -4104,11 +4081,7 @@ public class ConnectivityService extends IConnectivityManager.Stub if (isNetworkWithLinkPropertiesBlocked(lp, uid, false)) { return; } try { nai.networkMonitor().forceReevaluation(uid); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } } /** Loading Loading @@ -5541,11 +5514,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // Start or stop DNS64 detection and 464xlat according to network state. networkAgent.clatd.update(); notifyIfacesChangedForNetworkStats(); try { networkAgent.networkMonitor().notifyLinkPropertiesChanged(newLp); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } if (networkAgent.everConnected) { notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_IP_CHANGED); } Loading Loading @@ -6529,15 +6498,11 @@ public class ConnectivityService extends IConnectivityManager.Stub // command must be sent after updating LinkProperties to maximize chances of // NetworkMonitor seeing the correct LinkProperties when starting. // TODO: pass LinkProperties to the NetworkMonitor in the notifyNetworkConnected call. try { if (networkAgent.networkMisc.acceptPartialConnectivity) { networkAgent.networkMonitor().setAcceptPartialConnectivity(); } networkAgent.networkMonitor().notifyNetworkConnected( networkAgent.linkProperties, networkAgent.networkCapabilities); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } scheduleUnvalidatedPrompt(networkAgent); // Whether a particular NetworkRequest listen should cause signal strength thresholds to Loading services/core/java/com/android/server/connectivity/NetworkAgentInfo.java +7 −11 Original line number Diff line number Diff line Loading @@ -25,12 +25,12 @@ import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.net.NetworkMisc; import android.net.NetworkMonitorManager; import android.net.NetworkRequest; import android.net.NetworkState; import android.os.Handler; import android.os.INetworkManagementService; import android.os.Messenger; import android.os.RemoteException; import android.os.SystemClock; import android.util.Log; import android.util.SparseArray; Loading Loading @@ -247,7 +247,7 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> { public final Nat464Xlat clatd; // Set after asynchronous creation of the NetworkMonitor. private volatile INetworkMonitor mNetworkMonitor; private volatile NetworkMonitorManager mNetworkMonitor; private static final String TAG = ConnectivityService.class.getSimpleName(); private static final boolean VDBG = false; Loading Loading @@ -278,7 +278,7 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> { * Inform NetworkAgentInfo that a new NetworkMonitor was created. */ public void onNetworkMonitorCreated(INetworkMonitor networkMonitor) { mNetworkMonitor = networkMonitor; mNetworkMonitor = new NetworkMonitorManager(networkMonitor); } /** Loading @@ -290,13 +290,9 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> { */ public void setNetworkCapabilities(NetworkCapabilities nc) { networkCapabilities = nc; final INetworkMonitor nm = mNetworkMonitor; final NetworkMonitorManager nm = mNetworkMonitor; if (nm != null) { try { nm.notifyNetworkCapabilitiesChanged(nc); } catch (RemoteException e) { Log.e(TAG, "Error notifying NetworkMonitor of updated NetworkCapabilities", e); } } } Loading @@ -317,11 +313,11 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> { } /** * Get the INetworkMonitor in this NetworkAgentInfo. * Get the NetworkMonitorManager in this NetworkAgentInfo. * * <p>This will be null before {@link #onNetworkMonitorCreated(INetworkMonitor)} is called. */ public INetworkMonitor networkMonitor() { public NetworkMonitorManager networkMonitor() { return mNetworkMonitor; } Loading Loading
services/core/java/com/android/server/ConnectivityService.java +15 −50 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ import android.net.NetworkFactory; import android.net.NetworkInfo; import android.net.NetworkInfo.DetailedState; import android.net.NetworkMisc; import android.net.NetworkMonitorManager; import android.net.NetworkPolicyManager; import android.net.NetworkQuotaInfo; import android.net.NetworkRequest; Loading Loading @@ -1784,8 +1785,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // callback from each caller type. Need to re-factor NetdEventListenerService to allow // multiple NetworkMonitor registrants. if (nai != null && nai.satisfies(mDefaultRequest)) { Binder.withCleanCallingIdentity(() -> nai.networkMonitor().notifyDnsResponse(returnCode)); nai.networkMonitor().notifyDnsResponse(returnCode); } } Loading Loading @@ -2852,11 +2852,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // Notify the NetworkAgentInfo/NetworkMonitor in case NetworkMonitor needs to cancel or // schedule DNS resolutions. If a DNS resolution is required the // result will be sent back to us. try { nai.networkMonitor().notifyPrivateDnsChanged(cfg.toParcel()); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } // With Private DNS bypass support, we can proceed to update the // Private DNS config immediately, even if we're in strict mode Loading Loading @@ -3022,11 +3018,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // Disable wakeup packet monitoring for each interface. wakeupModifyInterface(iface, nai.networkCapabilities, false); } try { nai.networkMonitor().notifyNetworkDisconnected(); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } mNetworkAgentInfos.remove(nai.messenger); nai.clatd.update(); synchronized (mNetworkForNetId) { Loading Loading @@ -3439,11 +3431,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // // TODO: NetworkMonitor does not refer to the "never ask again" bit. The bit is stored // per network. Therefore, NetworkMonitor may still do https probe. try { nai.networkMonitor().setAcceptPartialConnectivity(); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } } } Loading Loading @@ -3475,11 +3463,7 @@ public class ConnectivityService extends IConnectivityManager.Stub NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(network); if (nai == null) return; if (!nai.networkCapabilities.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)) return; try { nai.networkMonitor().launchCaptivePortalApp(); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } }); } Loading Loading @@ -3514,7 +3498,7 @@ public class ConnectivityService extends IConnectivityManager.Stub } @Override public void appResponse(final int response) throws RemoteException { public void appResponse(final int response) { if (response == CaptivePortal.APP_RETURN_WANTED_AS_IS) { enforceSettingsPermission(); } Loading @@ -3524,16 +3508,9 @@ public class ConnectivityService extends IConnectivityManager.Stub if (nai == null) return; // nai.networkMonitor() is thread-safe final INetworkMonitor nm = nai.networkMonitor(); final NetworkMonitorManager nm = nai.networkMonitor(); if (nm == null) return; final long token = Binder.clearCallingIdentity(); try { nm.notifyCaptivePortalAppFinished(response); } finally { // Not using Binder.withCleanCallingIdentity() to keep the checked RemoteException Binder.restoreCallingIdentity(token); } } @Override Loading Loading @@ -4104,11 +4081,7 @@ public class ConnectivityService extends IConnectivityManager.Stub if (isNetworkWithLinkPropertiesBlocked(lp, uid, false)) { return; } try { nai.networkMonitor().forceReevaluation(uid); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } } /** Loading Loading @@ -5541,11 +5514,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // Start or stop DNS64 detection and 464xlat according to network state. networkAgent.clatd.update(); notifyIfacesChangedForNetworkStats(); try { networkAgent.networkMonitor().notifyLinkPropertiesChanged(newLp); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } if (networkAgent.everConnected) { notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_IP_CHANGED); } Loading Loading @@ -6529,15 +6498,11 @@ public class ConnectivityService extends IConnectivityManager.Stub // command must be sent after updating LinkProperties to maximize chances of // NetworkMonitor seeing the correct LinkProperties when starting. // TODO: pass LinkProperties to the NetworkMonitor in the notifyNetworkConnected call. try { if (networkAgent.networkMisc.acceptPartialConnectivity) { networkAgent.networkMonitor().setAcceptPartialConnectivity(); } networkAgent.networkMonitor().notifyNetworkConnected( networkAgent.linkProperties, networkAgent.networkCapabilities); } catch (RemoteException e) { e.rethrowAsRuntimeException(); } scheduleUnvalidatedPrompt(networkAgent); // Whether a particular NetworkRequest listen should cause signal strength thresholds to Loading
services/core/java/com/android/server/connectivity/NetworkAgentInfo.java +7 −11 Original line number Diff line number Diff line Loading @@ -25,12 +25,12 @@ import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.net.NetworkMisc; import android.net.NetworkMonitorManager; import android.net.NetworkRequest; import android.net.NetworkState; import android.os.Handler; import android.os.INetworkManagementService; import android.os.Messenger; import android.os.RemoteException; import android.os.SystemClock; import android.util.Log; import android.util.SparseArray; Loading Loading @@ -247,7 +247,7 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> { public final Nat464Xlat clatd; // Set after asynchronous creation of the NetworkMonitor. private volatile INetworkMonitor mNetworkMonitor; private volatile NetworkMonitorManager mNetworkMonitor; private static final String TAG = ConnectivityService.class.getSimpleName(); private static final boolean VDBG = false; Loading Loading @@ -278,7 +278,7 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> { * Inform NetworkAgentInfo that a new NetworkMonitor was created. */ public void onNetworkMonitorCreated(INetworkMonitor networkMonitor) { mNetworkMonitor = networkMonitor; mNetworkMonitor = new NetworkMonitorManager(networkMonitor); } /** Loading @@ -290,13 +290,9 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> { */ public void setNetworkCapabilities(NetworkCapabilities nc) { networkCapabilities = nc; final INetworkMonitor nm = mNetworkMonitor; final NetworkMonitorManager nm = mNetworkMonitor; if (nm != null) { try { nm.notifyNetworkCapabilitiesChanged(nc); } catch (RemoteException e) { Log.e(TAG, "Error notifying NetworkMonitor of updated NetworkCapabilities", e); } } } Loading @@ -317,11 +313,11 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> { } /** * Get the INetworkMonitor in this NetworkAgentInfo. * Get the NetworkMonitorManager in this NetworkAgentInfo. * * <p>This will be null before {@link #onNetworkMonitorCreated(INetworkMonitor)} is called. */ public INetworkMonitor networkMonitor() { public NetworkMonitorManager networkMonitor() { return mNetworkMonitor; } Loading