Merge "Rename object mNetd to mNetworkManagementService"
This commit is contained in:
@@ -259,7 +259,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
// 0 is full bad, 100 is full good
|
// 0 is full bad, 100 is full good
|
||||||
private int mDefaultInetConditionPublished = 0;
|
private int mDefaultInetConditionPublished = 0;
|
||||||
|
|
||||||
private INetworkManagementService mNetd;
|
private INetworkManagementService mNMS;
|
||||||
private INetworkStatsService mStatsService;
|
private INetworkStatsService mStatsService;
|
||||||
private INetworkPolicyManager mPolicyManager;
|
private INetworkPolicyManager mPolicyManager;
|
||||||
private NetworkPolicyManagerInternal mPolicyManagerInternal;
|
private NetworkPolicyManagerInternal mPolicyManagerInternal;
|
||||||
@@ -759,7 +759,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
mLingerDelayMs = mSystemProperties.getInt(LINGER_DELAY_PROPERTY, DEFAULT_LINGER_DELAY_MS);
|
mLingerDelayMs = mSystemProperties.getInt(LINGER_DELAY_PROPERTY, DEFAULT_LINGER_DELAY_MS);
|
||||||
|
|
||||||
mContext = checkNotNull(context, "missing Context");
|
mContext = checkNotNull(context, "missing Context");
|
||||||
mNetd = checkNotNull(netManager, "missing INetworkManagementService");
|
mNMS = checkNotNull(netManager, "missing INetworkManagementService");
|
||||||
mStatsService = checkNotNull(statsService, "missing INetworkStatsService");
|
mStatsService = checkNotNull(statsService, "missing INetworkStatsService");
|
||||||
mPolicyManager = checkNotNull(policyManager, "missing INetworkPolicyManager");
|
mPolicyManager = checkNotNull(policyManager, "missing INetworkPolicyManager");
|
||||||
mPolicyManagerInternal = checkNotNull(
|
mPolicyManagerInternal = checkNotNull(
|
||||||
@@ -849,7 +849,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
mTethering = makeTethering();
|
mTethering = makeTethering();
|
||||||
|
|
||||||
mPermissionMonitor = new PermissionMonitor(mContext, mNetd);
|
mPermissionMonitor = new PermissionMonitor(mContext, mNMS);
|
||||||
|
|
||||||
//set up the listener for user state for creating user VPNs
|
//set up the listener for user state for creating user VPNs
|
||||||
IntentFilter intentFilter = new IntentFilter();
|
IntentFilter intentFilter = new IntentFilter();
|
||||||
@@ -864,8 +864,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
new IntentFilter(Intent.ACTION_USER_PRESENT), null, null);
|
new IntentFilter(Intent.ACTION_USER_PRESENT), null, null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mNetd.registerObserver(mTethering);
|
mNMS.registerObserver(mTethering);
|
||||||
mNetd.registerObserver(mDataActivityObserver);
|
mNMS.registerObserver(mDataActivityObserver);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
loge("Error registering observer :" + e);
|
loge("Error registering observer :" + e);
|
||||||
}
|
}
|
||||||
@@ -896,7 +896,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
mMultipathPolicyTracker = new MultipathPolicyTracker(mContext, mHandler);
|
mMultipathPolicyTracker = new MultipathPolicyTracker(mContext, mHandler);
|
||||||
|
|
||||||
mDnsManager = new DnsManager(mContext, mNetd, mSystemProperties);
|
mDnsManager = new DnsManager(mContext, mNMS, mSystemProperties);
|
||||||
registerPrivateDnsSettingsCallbacks();
|
registerPrivateDnsSettingsCallbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,7 +912,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
return mDefaultRequest;
|
return mDefaultRequest;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return new Tethering(mContext, mNetd, mStatsService, mPolicyManager,
|
return new Tethering(mContext, mNMS, mStatsService, mPolicyManager,
|
||||||
IoThread.get().getLooper(), new MockableSystemProperties(),
|
IoThread.get().getLooper(), new MockableSystemProperties(),
|
||||||
deps);
|
deps);
|
||||||
}
|
}
|
||||||
@@ -1563,7 +1563,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
if (DBG) log("Adding legacy route " + bestRoute +
|
if (DBG) log("Adding legacy route " + bestRoute +
|
||||||
" for UID/PID " + uid + "/" + Binder.getCallingPid());
|
" for UID/PID " + uid + "/" + Binder.getCallingPid());
|
||||||
try {
|
try {
|
||||||
mNetd.addLegacyRouteForNetId(netId, bestRoute, uid);
|
mNMS.addLegacyRouteForNetId(netId, bestRoute, uid);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// never crash - catch them all
|
// never crash - catch them all
|
||||||
if (DBG) loge("Exception trying to add a route: " + e);
|
if (DBG) loge("Exception trying to add a route: " + e);
|
||||||
@@ -1853,7 +1853,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
if (timeout > 0 && iface != null && type != ConnectivityManager.TYPE_NONE) {
|
if (timeout > 0 && iface != null && type != ConnectivityManager.TYPE_NONE) {
|
||||||
try {
|
try {
|
||||||
mNetd.addIdleTimer(iface, timeout, type);
|
mNMS.addIdleTimer(iface, timeout, type);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// You shall not crash!
|
// You shall not crash!
|
||||||
loge("Exception in setupDataActivityTracking " + e);
|
loge("Exception in setupDataActivityTracking " + e);
|
||||||
@@ -1872,7 +1872,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI))) {
|
caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI))) {
|
||||||
try {
|
try {
|
||||||
// the call fails silently if no idle timer setup for this interface
|
// the call fails silently if no idle timer setup for this interface
|
||||||
mNetd.removeIdleTimer(iface);
|
mNMS.removeIdleTimer(iface);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Exception in removeDataActivityTracking " + e);
|
loge("Exception in removeDataActivityTracking " + e);
|
||||||
}
|
}
|
||||||
@@ -1919,7 +1919,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (VDBG) log("Setting MTU size: " + iface + ", " + mtu);
|
if (VDBG) log("Setting MTU size: " + iface + ", " + mtu);
|
||||||
mNetd.setMtu(iface, mtu);
|
mNMS.setMtu(iface, mtu);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Slog.e(TAG, "exception in setMtu()" + e);
|
Slog.e(TAG, "exception in setMtu()" + e);
|
||||||
}
|
}
|
||||||
@@ -2593,7 +2593,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
// NetworkFactories, so network traffic isn't interrupted for an unnecessarily
|
// NetworkFactories, so network traffic isn't interrupted for an unnecessarily
|
||||||
// long time.
|
// long time.
|
||||||
try {
|
try {
|
||||||
mNetd.removeNetwork(nai.network.netId);
|
mNMS.removeNetwork(nai.network.netId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Exception removing network: " + e);
|
loge("Exception removing network: " + e);
|
||||||
}
|
}
|
||||||
@@ -3772,7 +3772,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
Slog.w(TAG, "VPN for user " + user + " not ready yet. Skipping lockdown");
|
Slog.w(TAG, "VPN for user " + user + " not ready yet. Skipping lockdown");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setLockdownTracker(new LockdownVpnTracker(mContext, mNetd, this, vpn, profile));
|
setLockdownTracker(new LockdownVpnTracker(mContext, mNMS, this, vpn, profile));
|
||||||
} else {
|
} else {
|
||||||
setLockdownTracker(null);
|
setLockdownTracker(null);
|
||||||
}
|
}
|
||||||
@@ -4027,7 +4027,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
loge("Starting user already has a VPN");
|
loge("Starting user already has a VPN");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userVpn = new Vpn(mHandler.getLooper(), mContext, mNetd, userId);
|
userVpn = new Vpn(mHandler.getLooper(), mContext, mNMS, userId);
|
||||||
mVpns.put(userId, userVpn);
|
mVpns.put(userId, userVpn);
|
||||||
if (mUserManager.getUserInfo(userId).isPrimary() && LockdownVpnTracker.isEnabled()) {
|
if (mUserManager.getUserInfo(userId).isPrimary() && LockdownVpnTracker.isEnabled()) {
|
||||||
updateLockdownVpn();
|
updateLockdownVpn();
|
||||||
@@ -4644,7 +4644,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
mDnsManager.updatePrivateDnsStatus(netId, newLp);
|
mDnsManager.updatePrivateDnsStatus(netId, newLp);
|
||||||
|
|
||||||
// Start or stop clat accordingly to network state.
|
// Start or stop clat accordingly to network state.
|
||||||
networkAgent.updateClat(mNetd);
|
networkAgent.updateClat(mNMS);
|
||||||
if (isDefaultNetwork(networkAgent)) {
|
if (isDefaultNetwork(networkAgent)) {
|
||||||
handleApplyDefaultProxy(newLp.getHttpProxy());
|
handleApplyDefaultProxy(newLp.getHttpProxy());
|
||||||
} else {
|
} else {
|
||||||
@@ -4683,9 +4683,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
final String prefix = "iface:" + iface;
|
final String prefix = "iface:" + iface;
|
||||||
try {
|
try {
|
||||||
if (add) {
|
if (add) {
|
||||||
mNetd.getNetdService().wakeupAddInterface(iface, prefix, mark, mask);
|
mNMS.getNetdService().wakeupAddInterface(iface, prefix, mark, mask);
|
||||||
} else {
|
} else {
|
||||||
mNetd.getNetdService().wakeupDelInterface(iface, prefix, mark, mask);
|
mNMS.getNetdService().wakeupDelInterface(iface, prefix, mark, mask);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Exception modifying wakeup packet monitoring: " + e);
|
loge("Exception modifying wakeup packet monitoring: " + e);
|
||||||
@@ -4701,7 +4701,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
for (String iface : interfaceDiff.added) {
|
for (String iface : interfaceDiff.added) {
|
||||||
try {
|
try {
|
||||||
if (DBG) log("Adding iface " + iface + " to network " + netId);
|
if (DBG) log("Adding iface " + iface + " to network " + netId);
|
||||||
mNetd.addInterfaceToNetwork(iface, netId);
|
mNMS.addInterfaceToNetwork(iface, netId);
|
||||||
wakeupModifyInterface(iface, caps, true);
|
wakeupModifyInterface(iface, caps, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Exception adding interface: " + e);
|
loge("Exception adding interface: " + e);
|
||||||
@@ -4711,7 +4711,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);
|
||||||
wakeupModifyInterface(iface, caps, false);
|
wakeupModifyInterface(iface, caps, false);
|
||||||
mNetd.removeInterfaceFromNetwork(iface, netId);
|
mNMS.removeInterfaceFromNetwork(iface, netId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Exception removing interface: " + e);
|
loge("Exception removing interface: " + e);
|
||||||
}
|
}
|
||||||
@@ -4735,7 +4735,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
if (route.hasGateway()) continue;
|
if (route.hasGateway()) continue;
|
||||||
if (VDBG) log("Adding Route [" + route + "] to network " + netId);
|
if (VDBG) log("Adding Route [" + route + "] to network " + netId);
|
||||||
try {
|
try {
|
||||||
mNetd.addRoute(netId, route);
|
mNMS.addRoute(netId, route);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if ((route.getDestination().getAddress() instanceof Inet4Address) || VDBG) {
|
if ((route.getDestination().getAddress() instanceof Inet4Address) || VDBG) {
|
||||||
loge("Exception in addRoute for non-gateway: " + e);
|
loge("Exception in addRoute for non-gateway: " + e);
|
||||||
@@ -4746,7 +4746,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
if (route.hasGateway() == false) continue;
|
if (route.hasGateway() == false) continue;
|
||||||
if (VDBG) log("Adding Route [" + route + "] to network " + netId);
|
if (VDBG) log("Adding Route [" + route + "] to network " + netId);
|
||||||
try {
|
try {
|
||||||
mNetd.addRoute(netId, route);
|
mNMS.addRoute(netId, route);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if ((route.getGateway() instanceof Inet4Address) || VDBG) {
|
if ((route.getGateway() instanceof Inet4Address) || VDBG) {
|
||||||
loge("Exception in addRoute for gateway: " + e);
|
loge("Exception in addRoute for gateway: " + e);
|
||||||
@@ -4757,7 +4757,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
for (RouteInfo route : routeDiff.removed) {
|
for (RouteInfo route : routeDiff.removed) {
|
||||||
if (VDBG) log("Removing Route [" + route + "] from network " + netId);
|
if (VDBG) log("Removing Route [" + route + "] from network " + netId);
|
||||||
try {
|
try {
|
||||||
mNetd.removeRoute(netId, route);
|
mNMS.removeRoute(netId, route);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Exception in removeRoute: " + e);
|
loge("Exception in removeRoute: " + e);
|
||||||
}
|
}
|
||||||
@@ -4869,7 +4869,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
final String newPermission = getNetworkPermission(newNc);
|
final String newPermission = getNetworkPermission(newNc);
|
||||||
if (!Objects.equals(oldPermission, newPermission) && nai.created && !nai.isVPN()) {
|
if (!Objects.equals(oldPermission, newPermission) && nai.created && !nai.isVPN()) {
|
||||||
try {
|
try {
|
||||||
mNetd.setNetworkPermission(nai.network.netId, newPermission);
|
mNMS.setNetworkPermission(nai.network.netId, newPermission);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
loge("Exception in setNetworkPermission: " + e);
|
loge("Exception in setNetworkPermission: " + e);
|
||||||
}
|
}
|
||||||
@@ -4929,12 +4929,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
if (!newRanges.isEmpty()) {
|
if (!newRanges.isEmpty()) {
|
||||||
final UidRange[] addedRangesArray = new UidRange[newRanges.size()];
|
final UidRange[] addedRangesArray = new UidRange[newRanges.size()];
|
||||||
newRanges.toArray(addedRangesArray);
|
newRanges.toArray(addedRangesArray);
|
||||||
mNetd.addVpnUidRanges(nai.network.netId, addedRangesArray);
|
mNMS.addVpnUidRanges(nai.network.netId, addedRangesArray);
|
||||||
}
|
}
|
||||||
if (!prevRanges.isEmpty()) {
|
if (!prevRanges.isEmpty()) {
|
||||||
final UidRange[] removedRangesArray = new UidRange[prevRanges.size()];
|
final UidRange[] removedRangesArray = new UidRange[prevRanges.size()];
|
||||||
prevRanges.toArray(removedRangesArray);
|
prevRanges.toArray(removedRangesArray);
|
||||||
mNetd.removeVpnUidRanges(nai.network.netId, removedRangesArray);
|
mNMS.removeVpnUidRanges(nai.network.netId, removedRangesArray);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Never crash!
|
// Never crash!
|
||||||
@@ -5105,7 +5105,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
if (DBG) log("Switching to new default network: " + newNetwork);
|
if (DBG) log("Switching to new default network: " + newNetwork);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mNetd.setDefaultNetId(newNetwork.network.netId);
|
mNMS.setDefaultNetId(newNetwork.network.netId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Exception setting default network :" + e);
|
loge("Exception setting default network :" + e);
|
||||||
}
|
}
|
||||||
@@ -5501,12 +5501,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
try {
|
try {
|
||||||
// This should never fail. Specifying an already in use NetID will cause failure.
|
// This should never fail. Specifying an already in use NetID will cause failure.
|
||||||
if (networkAgent.isVPN()) {
|
if (networkAgent.isVPN()) {
|
||||||
mNetd.createVirtualNetwork(networkAgent.network.netId,
|
mNMS.createVirtualNetwork(networkAgent.network.netId,
|
||||||
!networkAgent.linkProperties.getDnsServers().isEmpty(),
|
!networkAgent.linkProperties.getDnsServers().isEmpty(),
|
||||||
(networkAgent.networkMisc == null ||
|
(networkAgent.networkMisc == null ||
|
||||||
!networkAgent.networkMisc.allowBypass));
|
!networkAgent.networkMisc.allowBypass));
|
||||||
} else {
|
} else {
|
||||||
mNetd.createPhysicalNetwork(networkAgent.network.netId,
|
mNMS.createPhysicalNetwork(networkAgent.network.netId,
|
||||||
getNetworkPermission(networkAgent.networkCapabilities));
|
getNetworkPermission(networkAgent.networkCapabilities));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user